YAHOOOOO - 1 year ago 131

C++ Question

I am writing a 3d vector class for OpenGL. How do I rotate a vector v1 about another vector v2 by an angle A?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

The easiest-to-understand way would be rotating the coordinate axis so that vector v2 aligns with the Z axis, then rotate by A around the Z axis, and rotate back so that the Z axis aligns with v2.

When you have written down the rotation matrices for the three operations, you'll probably notice that you apply three matrices after each other. To reach the same effect, you can multiply the three matrices.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**