Jump to content
Hash, Inc. Forums
Willi

euler to quaternion. quaternion to euler

Recommended Posts

hi,

 

how i can convert euler angles (as angles, not radian) to quaternions and wise versa (quaternions to euler)?

is there a function in the sdk?

Share this post


Link to post
Share on other sites

thanx nemyax.

i found it. RotateEuler does the trick for converting from quaternions.

to quaternion i found something in Rotate.h, like this

 

Quaternion quat;

RotateEuler euler;

euler.x = 10; euler.y = 20; euler.z = 30;

if ( euler.z )

quat = YXZRotateQ( euler.y, euler.x, euler.z );

else

quat = YXRotateQ( euler.y, euler.x );

 

maybe this can be shorter like:

 

Quaternion quat;

RotateEuler euler;

euler.x = 10;

euler.y = 20;

euler.z = 30;

quat= Quaternion(euler);

Share this post


Link to post
Share on other sites

euler.x = 10;

euler.y = 20;

euler.z = 30;

These should be in radians.

Share this post


Link to post
Share on other sites

this can be in degree, because YXZRotateQ converts degree to randians...

i tested it.

also RotateEuler euler(quat) converts quaternion (radians) to euler (degree).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×