Hash, Inc. Forums

## 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 on other sites

The Quaternion class (ftp://ftp.hash.com/pub/Sdk/AMSDKDoc/classQuaternion.html) has a constructor that takes a RotateEuler (ftp://ftp.hash.com/pub/Sdk/AMSDKDoc/classRotateEuler.html) as an argument. And one degree equals (pi/180) radians.

##### 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 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 on other sites Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.