# Rotation about an arbitrary axis?

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

## Recommended Posts

I have this code here that does just that:

D3DXMATRIX Rot(float delta, float rho) { float radDelta = delta*M_PI/180; float radRho = rho*M_PI/180; float a = cos(radRho); float b = sin(radRho); float si = sin(radDelta); float co = cos(radDelta); D3DXMATRIX m = D3DXMATRIX((co+a*a*(1-co)),(b*a*(1-co)),(b*si), 0, (a*b*(1-co)),(co+b*b*(1-co)),(-a*si), 0, (-b*si),(a*si),(co), 0, 0, 0, 0, 1); return m; }

However, the matrix returned from this function differs from the one calculated using:

D3DXMatrixRotationAxis(&rot2, &D3DXVECTOR3(cos(rho), sin(rho), 0), angle);

Output:
 // first matrix 0.881697 0.0430586 -0.469846 0 0.0430586 0.984328 0.17101 0 0.469846 -0.17101 0.866025 0 0 0 0 1 // second matrix 0.881697 0.0430586 0.469846 0 0.0430586 0.984328 -0.17101 0 -0.469846 0.17101 0.866025 0 0 0 0 1 

So as you can see i'm off by a couple of signs.. what gives?

##### Share on other sites
[font="arial, verdana, tahoma, sans-serif"]EDIT: ffs.. different row/column order........
</stupid>[/font]
[font="arial, verdana, tahoma, sans-serif"] [/font]

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013311
×