Explain 3d transformation matrix...

1.6k Views Asked by At

In programming language like CSS, there are matrices. Though I don't know matrix or matrix3d. I have tried to learn it again and again for one year. And have not been successful :( However, I do know now that matrices are added, multiplied, etc. I just don't know what each value among $16$ values mean. So, could someone please explain to me how this matrix is supposed to work?

1

There are 1 best solutions below

10
On BEST ANSWER

I think you don't need to understand the meaning of each one of the 16 matrix elements. You have to think in a matrix as a mathematical abstraction that represents some transformation, like a rotation, a translation, a scale or a perspective. When you multiply this matrix by a point, you get the transformed point. For example, if you have a matrix representing a rotation around an axis and you multiply this matrix by a point, you get the point rotated around this axis.

So, you have to understand that a matrix is just a convenient way of expressing a transformation and that you can apply this transformation to a point just by multiplying.

Now, why do we need 2x2, 3x3 or 4x4 matrices?. Basically it is related with the fact of if we are working in 2d or 3d. For example, to express transformation in 2d we just need a 2x2 matrix, to express rotation or scaling in 3d we need a 3x3 matrix and to express translation or perspective calculations in 3d we need a 4x4 matrix.

The way of constructing a matrix is just calculating matrices for single transformations and multiplying together to get the matrix representing the total transformation. Each individual transformation (matrix) can be constructed as is indicated in the link you have provided in your question.

EDIT:

If you look at the description for the RotateX(a) function, you will se that they specify the matrix form for this transformation:

1 0 0 0
0 cos(a) sin(a) 0
0 -sin(a) cos(a) 0
0 0 0 1

And the same for the RotateY(b) function:

$$\begin{pmatrix} \cos(b) & 0 & \sin(b) & 0 \\ 0 & 1 & 0 & 0 \\ -\sin(b) & 0 & \cos(b) & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$

So if you want to apply a combined transformation, use matrix3d( ...) with the matrix resulting of multiplying the ones above.

In general it is difficult to say the meaning of each one of the parameters in matrix3d. As this matrix is representing combined transformation, each element of the matrix is the result the several multiplications and additions as a result of the matrices multiplication.

Thus, you cannot expect to build this matrix just by knowing the meaning of each one of its parameters.