[Closed] Vector * Matrix
Is there any significance to why Position3 * Matrix3 is ok, but Matrix3 * Position3 is incompatible?
Well, your multipling a vector by each row of the matrix in the first instance. Where as if your multiply your 4X3 (columns * rows) matrix about 3 vectors its expecting a 4th vector because its multipling each unit of each row by a unit of the vector. The rule is if you multiply a matrix by a vector, the vector has to have the same amount of parts as columns in the matrix. (so if the matrix has 4 columns the vector has 4 parts: [x,y,z,w])
So for example:
|a1 a2 a3 a4|
|b1 b2 b3 b4|
|c1 c2 c3 c4| * [d,e,f,g] = a1d + a2e + a3f + a4e, b1*d etc, etc so:
COLUMNS X ROWS =
4X3 can multiply by a 4point vector [x,y,z,w]
3X3 can multiply by a 3point vector [x,y,z]
2X3 can multiply by a 2point vector [x,y]
1X3 can multiply by a float or integer
cheers,
I think it comes down to the fact that when 3dsmax is multiplying a point3 by a matrix3 then it is effectively doing a matrix multiplication (and matrix multiplication is not commutative meaning Matrix A * MatrixB != MatrixB * Matrix A). In fact it is only possible to perform an AB and a BA multiplication when then number of rows and columns are the same in both matricies. I.e Both A and B are nxn matricies (where n is an integer).
In this case, I assume that we are Mutliplying a point3 which is effectively a (1 x 3) Matrix (1 row and 3 columns) by a (3 x 3) matrix which is fine. However to try and do it the other way around i.e multiplying a (3×3) by a (1×3) is impossible which might be 3DsMax is not allowing it.
I might be wrong here since, I do not fully understand the inner workings of 3dsmax, but I hope I might have shed a little light on the matter…
EverZen
Hope I get this right…
A matrix3 value really is a 4×3 matrix (four rows). And a point3 value is a (1×3) row vector, therefore goes to the left of the matrix, not to the right.
The pure math would be to use “homogeneous coordinates” with a four element vector and a 4×4 matrix. Then a simple matrix multiplication as we learned it in school can represent all the (affine) 3D transformations we normally need.
I guess 3ds Max takes a shortcut here to save memory and computation time: If you multiply a vector with a matrix in 3ds Max, it will internally multiply the vector with the 3×3 sub-matrix and then add the fourth row. Therefore, some 3D transformations (projections) cannot be represented with matrices in 3ds Max IIRC.
– MartinB