Ok, I think I'm starting to understand the 4x4 Matrix and its relation ship to a basic 3D vector.
If I define a vector as: v={X,Y,Z}
Then that exact same Vector described (using the Matrix Identity) as a 4x4 Matrix would be:
Code:
M={
X, 0, 0, 0
0, Y, 0, 0
0, 0, Z, 0
0, 0, 0, 1
}
As there has been no rotation, translation, or scale applied. If I apply translation, rotation, and/or scale I can still retrieve the basic position (in world space) by using the Identity matrix and multiplying it by the result matrix. Thus a faster way to convert it from a Matrix to a BASIC world position would be to extract out those 3 parts.
Now, I have to setup a base matrix for translation, rotation, and scale then use that * the current matrix to perform translations, rotation, and scaling within 3D space. According to one article I found (http://www.gamedev.net/reference/art...article415.asp) those matrix should be:
Code:
Matrix for a 3D translation of (tx, ty, tz)
1 0 0 0
0 1 0 0
0 0 1 0
tx ty tz 1
Matrix for a 3D scaling of (sx, sy, sz)
sz 0 0 0
0 sy 0 0
0 0 sx 0
0 0 0 1
Matrix for a 3D rotation around the x axis of q
0 0 0 0
0 cos(q) sin(q) 0
0 -sin(q) cos(q) 0
0 0 0 1
Matrix for a 3D rotation around the y axis of q
cos(q) 0 -sin(q) 0
0 1 0 0
sin(q) 0 cos(q) 0
0 0 0 1
Matrix for a 3D rotation around the z axis of q
cos(q) sin(q) 0 0
-sin(q) cos(q) 0 0
0 0 1 0
0 0 0 1
So, I need to setup a basic set of routines or objects to handle all of this LOL.
Now, I'm also guessing that the Matrices above are for local space, and that I would basically need 1 Matrix per "object" (where object is a collection of "local" Vertices)?
- Jeremy
Bookmarks