Jump to content
  • Advertisement
Sign in to follow this  
Waaayoff

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
[font="arial, verdana, tahoma, sans-serif"]EDIT: ffs.. different row/column order........
</stupid>[/font]
[font="arial, verdana, tahoma, sans-serif"] [/font]
Someone please delete this..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!