Willi Posted August 9, 2016 Posted August 9, 2016 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? Quote
nemyax Posted August 9, 2016 Posted August 9, 2016 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. Quote
Willi Posted August 10, 2016 Author Posted August 10, 2016 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); Quote
nemyax Posted August 10, 2016 Posted August 10, 2016 euler.x = 10; euler.y = 20; euler.z = 30; These should be in radians. Quote
Willi Posted August 10, 2016 Author Posted August 10, 2016 this can be in degree, because YXZRotateQ converts degree to randians... i tested it. also RotateEuler euler(quat) converts quaternion (radians) to euler (degree). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.