매트릭스에서 회전정보 얻기

출처 : http://myevan.net/phpBB/viewtopic.php?t=87


코드:
D3DXMATRIX * pMatrix = [- Source -]; 

float sx = pMatrix->_32; 
float cx = sqrtf(1.0f - sx * sx); 

float x, y, z; 
if (cx < 0.00001f) 
{ 
     if (sx > 0) 
          x = D3DX_PI / 2; 
     else 
          x = -D3DX_PI / 2; 
     y = atan2f(pMatrix->_31, pMatrix->_11); 
     z = 0.0f; 
} 
else 
{ 
     x = atan2f(sx, cx); 
     y = atan2f(-pMatrix->_31, pMatrix->_33); 
     z = atan2f(-pMatrix->_12, pMatrix->_22); 
} 

pRotation->x = x; 
pRotation->y = y; 
pRotation->z = z;

Posted by chungki

2005/12/17 02:10 2005/12/17 02:10
,
Response
No Trackback , 3 Comments
RSS :
http://www.chungki.net/tc/rss/response/189


블로그 이미지

Nice !!!!!!!!

- chungki

Notices

Archives

Authors

  1. chungki

Calendar

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Site Stats

Total hits:
73376
Today:
7
Yesterday:
20