Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Matrix Extraction for data

Started by webjeff 0 replies 550+ views
Original Post
webjeff
webjeff
I am trying to extract 3d scale/position/rotation from a 4x4 transform matrix. Its easy enough to get the position vector. I think I have the rotation vector correctly, but someone who knows how to get all 3 vectors would be great. Any help would be appreciated. Especially because the scale is inheriently combined with the rotation components in the transform matrix. Any ideas would help. Jeff.
Zakwayda
Zakwayda
I'm not sure what you mean by rotation vector, but assuming the matrix represents the sequence S->R->T, here's how to extract the info:

1. Position comes straight from translation vector (which you already know)
2. Scale factors are the lengths of the basis vectors (rows or columns of upper-left 3x3 matrix)
3. Divide basis vectors by scale factors to orthonormalize
4. Stop there, or convert basis vectors into something else (axis-angle, Euler angles, quat) if desired

Let us know if you need any clarification. Also, if you need more specific help perhaps you could tell us whether the matrix is in row- or column-vector form.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.