[Closed] How can i calculate the scalerotationpart of a matrix
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
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!
thanks cesar for your reply,
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.