   arbitrary-axis rotation matrix
  Not sure if this is the right place to post this, but i am trying to build a 4X4 matrix that will rotate a 3D object around an arbitraty axis (x,y,z)The axis vector (x,y,z) need not be normalized.The angle a is measured in radians. If the rotation axis faces the user,the rotation will be counterclockwise.x -->  Specifies the X component of the axis of rotation.y -->  Specifies the Y component of the axis of rotation.z -->  Specifies the Z component of the axis of rotation.a -->  Specifies the rotation angle, in radians.I am working in C++ and i think i am close, but while the object rotates it changes shape. Any help would be great, thanks.   
  Well, check out how glRotate does it.   ;  This can be found various places online [Edit: e.g. Sneftel's link], but here's another reference you can check your code against:    // Some values you'll need (note that x, y and z are    // the components of the unit-length input axis):    T s = sin(angle);    T c = cos(angle);    T omc = (T)1.0 - c;    T xomc = x * omc;    T yomc = y * omc;    T zomc = z * omc;   T xxomc = x * xomc;    T xyomc = x * yomc;    T xzomc = x * zomc;    T yyomc = y * yomc;    T yzomc = y * zomc;    T zzomc = z * zomc;   T xs = x * s;    T ys = y * s;    T zs = z * s;    // The matrix is then:   [ xxomc + c,  xyomc + zs, xzomc - ys ]    [ xyomc - zs, yyomc + c,  yzomc + xs ]    [ xzomc + ys, yzomc - xs, zzomc + c  ]    // This is in row-vector form; simply transpose if you're using column vectors.;  Thank you both, I had tried that matrix before but it looks like i was forgetting to normalize the vector, now its works like a charm :).   ;  I got great help with my last question, and i have one last problem:The alignment matrix aligns the model space Y axis with the specifiedaxis vector (x,y,z) (which need not be normalized). The rotation isperformed about the vector (a ^ b), where a is (0,1,0) and b is (x,y,z).x --> Specifies the X component of the axis of alignment.y --> Specifies the Y component of the axis of alignment.z --> Specifies the Z component of the axis of alignment.I am having some trouble building the 4X4 rotation matrix that preforms this action, any help would be great, Thanks.