• ### Popular Now

• 13
• 18
• 19
• 27
• 10

#### Archived

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

# quaternions: what is w for

This topic is 5106 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.

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;}