Radian angle to Quaternion
-
Hi, I have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation. Regards, Shoaib
Its never over !
-
Hi, I have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation. Regards, Shoaib
Its never over !
shaibee wrote:
have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation.
You want to convert an axis angle, for example? A rotation around an axis in space can be converted to a quaternion
Q(w,x,y,z)
. If the rotation is given by a unit vector(ax, ay, az)
and the angletheta
is in radians, then the conversion is: w = cos(theta/2) x = ax * sin(theta/2) y = ay * sin(theta/2) z = az * sin(theta/2) Make sure the axis is normalized before conversion. If there is no rotation, the quaternion is the rotation identity quaternion. -
shaibee wrote:
have a double value describing rotation angle for a text box object. I need to convert it to quaternion. I have searched the web, and all I get is converters that conver Euler angle to Quaternion. I would appreciate any formulae or algorithm. And this double value is the only information I have for rotation.
You want to convert an axis angle, for example? A rotation around an axis in space can be converted to a quaternion
Q(w,x,y,z)
. If the rotation is given by a unit vector(ax, ay, az)
and the angletheta
is in radians, then the conversion is: w = cos(theta/2) x = ax * sin(theta/2) y = ay * sin(theta/2) z = az * sin(theta/2) Make sure the axis is normalized before conversion. If there is no rotation, the quaternion is the rotation identity quaternion.73Zeppelin wrote:
rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians
I believe I have
theta
, but I dont see any vector provided along with in the information object that I have. All it says is "angle in radians rotated from +ve world x-axis". Does this indicate any default vector that I can use for this conversion?Its never over !
-
73Zeppelin wrote:
rotation is given by a unit vector (ax, ay, az) and the angle theta is in radians
I believe I have
theta
, but I dont see any vector provided along with in the information object that I have. All it says is "angle in radians rotated from +ve world x-axis". Does this indicate any default vector that I can use for this conversion?Its never over !
So it's a rotation about the x-axis? This means the rotations around the other axes can be taken as zero. So your rotation vector would be: (ax, ay, az) = (theta, 0, 0) Don't forget to convert to a unit vector[^] if necessary.