D3DXMatrixTransformation Question

Started by
3 comments, last by NovaCaine 18 years, 7 months ago
Hey all, just a question in regards to the above function. Could someone explain to me what the pScaleRotation pointer is for? I've always thought of scale and rotation as 2 separate parts of the equation.
Quote: D3DXMATRIX *WINAPI D3DXMatrixTransformation( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, CONST D3DXQUATERNION *pScalingRotation, <---- What does this do? CONST D3DXVECTOR3 *pScaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation );
Any help would be great. Thx
Advertisement
If you look at the help page for D3DXMatrixTransformation, you'll see this expression for what is going on:

Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt

To compute the scaling part (Msc-1 * Msr-1 * Ms * Msr * Msc), it is translating and rotating into a coordinate system where it can scale along the primary axes about the origin, performing the scale, and then rotating and translating it back.

To compute the rotation part (Mrc-1 * Mr * Mrc), it is translating into a coordinate system where it can rotate about the origin, performing the rotation, and then translating back.

The translation part is easy.

xyzzy
Yeah i got the rest, Matrix math is a pretty new concept to me.

Cheers for the help, one last question thou, could you possibly give me an example of where one may want to change this value away from it's Identity?
I don't know.. perhaps if you wanted to perform a non-uniform scale about some arbitrary axes. In practice, non-uniform scales generally more of a headache than they are worth, so you are probably better off sticking to them, and using D3DXMatrixAffineTransformation instead.

xyzzy
xyzzy00, you legend!

that function is alot easier for me to understand, Cheers for the help!

This topic is closed to new replies.

Advertisement