Neo Posted June 5, 2012 Share Posted June 5, 2012 Greetings, I need to interpolate transformations between two matrices, unless there is a fucntion that do just that, I need to extract all transformations separately and interpolate the transformations one by one and rebuild a new matrix from the result. To help me in this process, UT_DMatrix4::getTranslates and UT_DMatrix4::extractRotation are very handy but my question is: How do we get the scaling from a UT_DMatrix4? Quote Link to comment Share on other sites More sharing options...
mightcouldb1 Posted June 6, 2012 Share Posted June 6, 2012 (edited) I'm not sure if there is a method off of the top of my head. You could extract the scale by taking vec3.x = matrix4[0][0], vec3.y = matrix4[1][1], vec3.z = matrix4[2][2] since the scale is stored along the diagonal. I suggest looking at spherical linear interpolation. I think that there would be a slerp and lerp function in the HDK for matrices. Edit: Also, this website is very good. http://www.euclideanspace.com/maths/algebra/matrix/transforms/index.htm Edited June 6, 2012 by mightcouldb1 Quote Link to comment Share on other sites More sharing options...
0rr Posted June 6, 2012 Share Posted June 6, 2012 You can use the explode method do get sperate translation,scale and rotation matrices. Quote Link to comment Share on other sites More sharing options...
edward Posted June 8, 2012 Share Posted June 8, 2012 If you want to do it the "best" way, you should use UT_Matrix3::splitRotationScale() (assign to a UT_Matrix3 variable from your UT_Matrix4 variable to use the method). This gives you back rotation/scale matrices which can then be extracted for interpolation (UT_Quaternion for the rotation, component-wise interpolation for the scale). For an idea of what could go wrong for bad cases, look at the pictures from this 1992 paper http://research.cs.w...olar-decomp.pdf Quote Link to comment Share on other sites More sharing options...
Neo Posted June 19, 2012 Author Share Posted June 19, 2012 Thank you all for your suggestions, I managed to exorcised any Math reference whit my own library. Much simpler that way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.