[PD] GEM/math: correctly rotating in space
Tebjan Halm
tebjan at gmx.de
Mon Oct 17 13:26:44 CEST 2005
Frank Barknecht schrieb:
>Hallo Tebjan,
>Tebjan Halm hat gesagt: // Tebjan Halm wrote:
>
>
>
>>was tricky, but there is a more or less easy solution if you use two rotate
>>objects. first rotate around the z axis with:
>>
>>180/3.14159265 * atan2($f2, $f1);
>>
>>then rotate the cube around its y axis with:
>>
>>180/3.14159265 * (acos($f3/$f4)-3.14159265/2);
>>
>>where $f4 is the length of the diff vector. the subtraction of half pi
>>(90 degree)
>>was found by trial and error ...
>>
>>attached is the solution (i hope).
>>
>>
>
>YESSS! Thank you a lot this is working perfectly as intended!
>
>I just changed:
>
> 180/3.14159265 * (acos($f3/$f4)-3.14159265/2);
>
>to be:
>
> 180/3.14159265 * acos($f3/$f4) - 90;
>
>as that is a bit easier to read any maybe a little bit faster and more
>accurate as well.
>
>
yeah, of course. was thinking to much in radians ...
nice to hear that its working.
adios
>Ciao
>
>
More information about the Pd-list
mailing list