# Matrix.RotationAxis Question

## Recommended Posts

k00k    272
Guys im currently writting a graphics engine wrapper for MDX. and I have implemented my own Matrix Struct as I have that fairly done I need some help with a few of the Methods inside the Matrix Functions in DirectX. First Does anyone have the (Math) behind Matrix.RotationAxis(vector, float)? I need to add that method to mu struct but im not sure of what it is doing .. does is just take the vector and add the angle to the vectors X,Y and Z positions? also im trying to override Vector3.TransformNormal as well. if anyone can help I would apreciate it thanks

##### Share on other sites
jamba    124
k00k    272
Ok so nobody know's whats going on behind the doors of D3DXMatrixRotationAxis's method? thats basically the only one I need I figured out the TransformNormal Method.

##### Share on other sites
Egelsoft    122
Well the RotationAxis function builds a rotaion matrix that rotates an object an arbitrary amount an arbitrary axis :) now we got that out of the way... to the math!

Have you implemented Quaternions yet? Oh hell you can use DX's quats, just do like so:
Quaternion rotation = Quaternion.RotationAxis(<your axis here>, <your angle here>);return Matrix.FromQuaternion(rotation);

In case you haven't implemented Quaternions yet, you might wanna look here. It's bad graphics but it's a good resource.