[PD] GEM/math: correctly rotating in space
Frank Barknecht
fbar at footils.org
Sun Oct 16 03:43:00 CEST 2005
Hallo,
Tebjan Halm hat gesagt: // Tebjan Halm wrote:
> if i understand your patch, you just have to calculate the
> angles of the spherical coordinates of your second point.
>
> r = length (of your diff vector)
>
> angle 1:
> atan2( y, z )
>
> angle 2:
> acos( z/r )
>
> angle3:
> 0
>
> and remember, two angles are always sufficiant in 3d space ;)
This sounds good and thank you a lot for this clarification. Now with
my first rotation around the Z-axis I basically do the transformation
to polar coordinates: distance r and angle inside the XY-plane. IIR I
then need to rotate again by the angle, that the difference vector has
to the xy-plane (often called Phi and basically it is "angle 2")
However while I think I know how to find the correct angle, I still
have difficulties to find the *axis* to rotate around. In (my) theory
I would need to rotate around the vector, which is the result of the
outer/cross product of the difference vector and the z-axis, because
that is the vector which is rectangular to both the diff. vector and
z-axis. However I already tried that, and it still looks very wrong.
Ciao
--
Frank Barknecht _ ______footils.org_ __goto10.org__
More information about the Pd-list
mailing list