Sign in to follow this  
NovaCaine

D3DXMatrixTransformation Question

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this