[PD] GEM/math: correctly rotating in space

Tebjan Halm tebjan at gmx.de
Sat Oct 15 19:57:51 CEST 2005


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 ;)

hope that helps ...

best wishes,
tebjan

Frank Barknecht schrieb:

>Hallo,
>
>could someone maybe help me do something against my headache, which
>has its reason in the buggy patch attached (open "move-in-space.pd")? 
>
>Problem: I want to move and scale a primitive like [cube] or [sphere]
>etc. so that both its ends fall on two given points in the 3D space. I
>currently use a combination of stretching with scaleXYZ, translating
>and rotating the [cube]. Lok in [solid-link] for details. It's very
>likely that I do the rotation stuff wrong, however I can't fidn the
>right way. Sometimes it sucks being an audio guy primarily.
>
>In just two dimensions what I want to achieve already works as can be
>seen in attached patch - which requires [list] btw. However as soon as
>the two points don't fall into the (x,y) plane anymore, that is, one
>of them has a differenc Z-coordinate than the other, everything falls
>apart. 
>
>I kind of know that the order of rotations probably is wrong, that I
>should use some kind of matrix transformation instead, quaterions,
>etc. however I'm so confused now: Any help is appreciated! 
>
>Ciao
>  
>






More information about the Pd-list mailing list