Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


quaternions: what is w for

This topic is 5318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Nope, you use all 4. In general a quaternion is an extension of complex numbers, you have 1 real component and 3 imaginary components. When used for rotations I think the closest way of visualizing it is the imaginary components make up a 3d vector that is a representation of the axis of rotation and the real component represents the angle rotated around the axis.

Someone who knows more about quaternion rotations should be able to tell you more about how to convert from axis-angle rotations to quaternion rotations, it might give you a better idea of how they work.

Share this post

Link to post
Share on other sites
w is something like the cos of half of the angle, while x, y, z represents the axis, times the sin of half of the angle.

Quaternion& Quaternion::FromRotation(const Vector& NormalisedAxis, float fAngle)
float a = fAngle * 0.5f;
float si = sin(a);
float co = cos(a);
x = NormalisedAxis.x * si;
y = NormalisedAxis.y * si;
z = NormalisedAxis.z * si;
w = co;

return *this;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!