[PD] GEM/math: correctly rotating in space

cyrille henry cyrille.henry at la-kitchen.fr
Sun Oct 16 13:46:10 CEST 2005


hello Frank,

maybee you can have a look at the tLink3D object of the pmpd lib.

just send position of your 2 points on the 2 inlets, you'll have the 
orientation output in a gem compatible way.
hum, i think so, but i never used this object to much...

cyrille


Frank Barknecht a écrit :
> 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




More information about the Pd-list mailing list