Original Post
🔒 Locked
Matrix
Advertisement
a matrix is a form to write some numbers! in 3d oprogramming there are 2 types(mostly) 1*4 and 4*4! a point in 3d can be represented by a 1*4 matrix: [x y z 1]
4*4 matrices hold rotations, scales, and translations! if you multiply a 1*4 matrix holding a point with a 4*4 matrix holding a rotation, the point gets rotated!
glLoadIdentity() just loads an identiy matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
every matrix multiplied with with matrix will remain the same as before! call the function on every step, the do all the glrotate()...!
4*4 matrices hold rotations, scales, and translations! if you multiply a 1*4 matrix holding a point with a 4*4 matrix holding a rotation, the point gets rotated!
glLoadIdentity() just loads an identiy matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
every matrix multiplied with with matrix will remain the same as before! call the function on every step, the do all the glrotate()...!
Matrices do indeed hold the value of tranforms. There are 4 main kinds of transformation matrices.
Anything multiplyed by the identity matrix comes out the same.
Translation Matrix
When applied to a 3d object, it translates it using the x,y,z coordinates.
Scale Matrix
Anything multipled by this matrix will be scaled by the x, y, and z values.
Rotation Matrix
Y Rotation
Z Rotation:
Thses matrices rotate an object on the x, y, or z axis depending on which matrix you use.
These matrices can be multipled together to achive multiple transforms. YOu can multiply a translation and rotation matrix together to get a matrix thatdoes both. Dont forget however that matrix multiplication is NOT communative so A * B != B * A.
--------------------------
Those who dance are considered insane by those who cannot hear the music.
Edited by - terminate on December 24, 2001 11:25:42 AM
Identity Matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Anything multiplyed by the identity matrix comes out the same.
Translation Matrix
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1
When applied to a 3d object, it translates it using the x,y,z coordinates.
Scale Matrix
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
Anything multipled by this matrix will be scaled by the x, y, and z values.
Rotation Matrix
X Rotation:
1 0 0 0
0 cos(R) sin(R) 0
0 -sin(R) cos(R) 0
0 0 0 1
Y Rotation
cos(R) 0 -sin(R) 0
0 1 0 0
sin(R) 0 cos(R) 0
0 0 0 1
Z Rotation:
cos(R) sin(R) 0 0
-sin(R) cos(R) 0 0
0 0 1 0
0 0 0 1
Thses matrices rotate an object on the x, y, or z axis depending on which matrix you use.
These matrices can be multipled together to achive multiple transforms. YOu can multiply a translation and rotation matrix together to get a matrix thatdoes both. Dont forget however that matrix multiplication is NOT communative so A * B != B * A.
--------------------------
Those who dance are considered insane by those who cannot hear the music.
Edited by - terminate on December 24, 2001 11:25:42 AM
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement