This is a bit (100%) out of Panda3D . But this is the place where i know the more talented Python guys so…
I need to code in pure python (not using P3D no using numerics) a function to convert Axis Angle to a single quaternion.
I have 2 bones (Master and Child). I know the child “position” relative to the parent position by the 3 angles around x,y,z axis. (in degrees).
I must provide 1 single quaternion that provide the child position in parent space.
From what i remember from quaternion i will need to :
convert angles to radian
calculate 1 quaternion (x,y,z,w) for each axis angle by
a)getting a normalized axis vector
b) doing some cos/sin calculation on each member of the quaternion
c) normalize the resulting quaternion
add the 3 resulting quaternion to make the single one.
Is there any trick i did not forecasted? if you any sourcecode on the topic i’m very interrested…
I found it in the “Python Package Index” (pypi), formerly known as the “Python Cheeseshop”. Not the same as CPAN for Perl, but still it has more than 2000 packages listed. Always a good idea to search here for something you need in Python: http://cheeseshop.python.org/pypi http://pypi.python.org/pypi