Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / scaling coefficients Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 13, 2005, 04:20 PM

does anyone know a quick way to obtain a 4x4 transformation matrix's 3 scaling coefficients? thanks.


April 13, 2005, 04:23 PM

  2. float scaleX = matrix[ 0 ][ 0 ];
  3. float scaleY = matrix[ 1 ][ 1 ];
  4. float scaleZ = matrix[ 2 ][ 2 ];

If this is not what you want than i misunderstood your question.


April 13, 2005, 04:26 PM

doesn't that only work if the model hasn't been rotated?


April 13, 2005, 04:47 PM

You're probably right, i'm not quite sure about this. If that doesn't work, constuct a matrix with the inverse rotation of your transformation matrix and multiply them to null out the rotation and then you can use the above method. :P


April 13, 2005, 05:09 PM

Assuming that the 4x4 matrix consists of only rotations, translations, and scales (no shears, reflections, projections or other funny business), you can get the x, y, and z scaling factors as the magnitude of the first, second, and third columns of the upper-left 3x3 submatrix. That is, consider each column as a 3-dimensional vector and take its magnitude in the usual way.


April 13, 2005, 05:21 PM

i think that's almost it, but negative scaling should be valid too. this method would always return positive scaling coefficients.


April 13, 2005, 05:30 PM

actually, i think if you multiply the magnitude by the axis' diagonal element, you can get the general scaling coefficient. thanks guys!


April 13, 2005, 05:30 PM

Maybe find the rotation matrix by normalizing in this way, then multiply by the transpose. Result should be the scale matrix.

This thread contains 8 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.