- number_power_handler for MatrixPy, PlacementPy and RotationPy is wrong
- VectorPy::number_multiply_handler has been extended by MatrixPy, RotationPy and PlacementPy but the implementation doesn't make sense to me and from a math point of view it is wrong
Code: Select all
m=App.Matrix()
m.scale(2,2,2)
m**1 # => Matrix ((4,0,0,0),(0,4,0,0),(0,0,4,0),(0,0,0,1))
It's possible to multiply a vector on the left with a matrix on the right. But therefore the vector must be a row vector and the output will be again a row vector. But the implementation returns a scaled matrix which is quite strange.
For PlacementPy and RotationPy a vector is returned but the implementation does exactly the same as when multiplying a rotation/placement on the left with a vector on the right. Thus it leads to some confusion because people may assume that matrix multiplication is commutative which in general it is not.
As said above when multiplying a vector v with a matrix M then we need a row-vector v^T, i.e. its transformed and afterwards must transpose the result again to get a column vector. This means we do:
(v^T * M)^T <==> M^T * v^T^T <==> M^T * v
OpenInventor's class SbMatrix has the methods multMatrixVec and multVecMatrix and for the latter it also uses the transposed matrix for the multiplication.