#### Archived

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.

## Recommended Posts

in a 3d area do you use w? or is it for 4d, and if so do i leave w at 0?

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

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632936
• Total Posts
3009312
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!