How do you scale an object using matrices?

I have been asked to uniformly resize an object by a scale factor 1.5 about the point (0.1, 0.3, 0.1).

I have this so far, but I believe that the D3DMatrix 2nd mention is the error here. I think it should be something else, but can't figure out what.

D3DXMatrixScaling( &m_matWorld, D3DXMatrix(1.5,1.5,1.5f) );

I also have no idea how to scale this object by the points specified.

If I find a solution to this before an answer is given. I will post up what I did to help anyone else who has this touble.
Last edited on
http://msdn.microsoft.com/en-us/library/bb205363(VS.85).aspx
note the parameters.
also, if you want to know what that function does, see http://en.wikipedia.org/wiki/Transformation_matrix and http://en.wikipedia.org/wiki/Scaling_(geometry)

to scale it about a point P, move the object into a coordinate system with center P, scale, and them move it back.
It's been a while since I did those thing myself, so I may be wrong, but I think it should be
1
2
3
m_matWorld = (*D3DXMatrixTranslation(&D3DXMatrix(), -0.1, -0.3, -0.1) ) *
(*D3DXMatrixScaling(&D3DXMatrix(), 1.5, 1.5, 1.5) ) *
(*D3DXMatrixTranslation(&D3DXMatrix(), 0.1, 0.3, 0.1)); 
or something like that..
that looks like it should work fine. You didn't put any code in though so I'm not sure how you're storing or foruming your world matrix. If you should ever need to combine separate matrices by multiplication to make the world matrix, multiply them in this order:

scale * rotation * translation.
Thanks alot for your help. I did understand what I needed to do in the form of model to world stuff it was just the coding.
Topic archived. No new replies allowed.