(2018-03-15, 14:05)Joscha Wrote: Coming back to the matrix type. You describe that it is a 4x4 matrix initialised as identity matrix. But for the location and orientation only 12 elements are used. Do the four remaining elements contain information?
The 12 elements are what is used in LDraw "type 1" lines. It's a position and 3x3 rotation matrix. Internally this is stored in a 4x4 matrix but one column (or row depending how you look at it) is (or should be) always 0 0 0 1 as it assumes the matrices only contain a rotation and translation.
ps: I noticed an error in my code which works only because of a fluke:
Code:
local matrix=ldc.matrix()
matrix:setTranslate(center:getInverted())
matrix:mulAB(rotation)
matrix:mulAB(center)
Code:
local matrix=ldc.matrix()
matrix:setTranslate(center:getInverted())
matrix:mulAB(rotation)
matrix:mulTranslateAB(center)