For example, I have a spaceship 3D model. I can calculate the matrix of its orientation:
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationX(&RotMat, Angles.x );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationY(&RotMat, Angles.y );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationZ(&RotMat, Angles.z );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixTranslation( &matTrans, Point.x, Point.y, Point.z );
D3DXMatrixMultiply( &matWorld, &matWorld,& matTrans );
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld);
Now, having the matWorld matrix (it completely defines plane's orientation, doesn't it?), I need to extract "forward" and "left" vectors for my plane from it. How can it be done?
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationX(&RotMat, Angles.x );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationY(&RotMat, Angles.y );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixIdentity( &RotMat );
D3DXMatrixRotationZ(&RotMat, Angles.z );
D3DXMatrixMultiply(&matWorld, &RotMat, &matWorld);
D3DXMatrixTranslation( &matTrans, Point.x, Point.y, Point.z );
D3DXMatrixMultiply( &matWorld, &matWorld,& matTrans );
m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld);
Now, having the matWorld matrix (it completely defines plane's orientation, doesn't it?), I need to extract "forward" and "left" vectors for my plane from it. How can it be done?