Archived

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

Whats the math of reotating a normal.

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

Recommended Posts

I have a unit vector. And i have x y and z angles. How do I find the rotated vector?

Share on other sites
The simple way is to do: v*Rx*Ry*Rz=w
v the unit vector
Rx Rotate Matrix about x axis
Ry Rotate Matrix about y axis
Rz Rotate Matrix about z axis
w the rotated vector

Share on other sites
how do you find the "Rx Rotate Matrix about x axis"?

Share on other sites

const float fCos = cosf(DEG2RAD(angle));const float fSin = sinf(DEG2RAD(angle));NewVector = (RotatingVector * fCos) + ((AxisVector * RotatingVector) * (1.0f - fCos)) * AxisVector + (RotatingVector x AxisVector) * fSin);

Where:

angle is angle you are rotating by
RotatingVector is the vector you are rotating
AxisVector is the vector you are rotating around
vector * vector = (v1.x * v2.x, v1.y * v2.y, v1.z * v2.z)
vector * scalar = (v.x * s, v.y * s, v.z * s)
vector + vector = (v1.x + v2.x, v1.y + v2.y, v1.z + v2.z)
vector x vector = cross product of v1 and v2

As to how it works, I have no idea.

1. 1
2. 2
3. 3
Rutin
23
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633653
• Total Posts
3013166
×