View Full Version : 3D Track Data Converter

 bartrobinson01 January 2004, 04:47 PMHey, I have a question for you folks. I'm writing a converter to translate 3D Tracking Data to and from MaxScript. I noticed in some sample data that a camera's rotation is represented by a 4x3 matrix (4 rows x 3 elements per row) with the last row being filled with 0's, possibly making it essentially a 3x3 matrix. Can anyone tell me what this matrix represents and maybe give me a pointer to converting this matrix in to a rotation represented by degrees or radians. The script looks something like this at the point which I am talking about. ... c = camera() ... at time 0f c.rotation = (matrix3 [[0.003, 0.010, 0.000] [0.003, 0.002, 0.001] [0.001, 0.013, 0.002] [0, 0, 0]]) Thanks a lot. Bart Robinson Dynavision|FX
01 January 2004, 11:42 PM
Transform matrices are a complex subject, and require an understanding of higher mathematics that I do not possess. Nonetheless, there are some things I understand about them, and how to apply them. In short, the transform matrix contains all the information needed to express the orientation (rotation), scale, and position of an object in 3D space. Transformations occur when a matrix is multiplied by another matrix. In the 4x3 matrix used in Maxscript, the fourth row represents the translation.

Since a matrix3 represents all of rotation, scale, and position, the statement \$obj.rotation = tm (where tm is a matrix3 value) is actually casting tm to a quat for assignment to the rotation property of obj. In other words, it's pulling just the rotation part out of the matrix and then assigning that to \$obj.rotation. You can manually extract the rotation by using rot = tm as quat or rot = tm as eulerAngles, or get it as a quat by simply stating rot = tm.rotation

If you really want to get into the hardcore details of transform matrices, there's plenty of information out there on the web and in math books at your local library. But in order to successfully apply them you really don't need to know much about how they work "under the hood." I'm afraid that's all the more helpful I can be on this subject:hmm:

RH

CGTalk Moderation
01 January 2006, 03:00 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.

1