PDA

View Full Version : How can i calculate the scalerotationpart of a matrix


phoelix
04-28-2009, 08:32 PM
Hi there,

I've been programming a controller in the 3ds max sdk, but i've got a problem finding the scale value of a matrix, i need that value even if the matrix is sheared, so a simple vector is not enought, i'll need the vector defining the amount of scaling and a quaternion defining the axis of the scale. In maxscript there are some properties of the Matrix3 class that expose those values
(scalerotationpart and scalepart), but i haven't found something similar in the sdk.

Is there any function to do that in the SDK?, or do you know the way that maxscript calculate the scalerotationpart and scalepart from the matrix?

thanks :D

csaez
04-30-2009, 02:43 AM
Hi phoelix

I have no idea about the methods in the SDK but you can calculate the length of the first 3 rows/vectors in the transformation matrix to have the scale. The equivalent of something like this.
[(length $.transform[1]), (length $.transform[2]), (length $.transform[3])]

For the rotation part maybe this can help.
http://www.gamedev.net/community/forums/topic.asp?topic_id=339800

Cheers!

phoelix
04-30-2009, 10:58 PM
thanks cesar for your reply, :D

unfortunately, the scale value that you mention, using the lengths of the first three rows, only works for uniform scaling, if the transform is sheared (skewed) i'll need the scalerotationpart, which defines the axis of scaling :'(.

eek
05-01-2009, 03:19 AM
thanks cesar for your reply, :D

unfortunately, the scale value that you mention, using the lengths of the first three rows, only works for uniform scaling, if the transform is sheared (skewed) i'll need the scalerotationpart, which defines the axis of scaling :'(.

Isnt skewing caused by the an un-othogonal matrix? For that couldnt you use a cross product and then the dot of it to determine if the axis' aren't 90 degrees to one another.

CGTalk Moderation
05-01-2009, 03:19 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.