Notifications
Clear all

[Closed] Matrices and coordinate systems

Does this work?

tm = $.transform -- Source Matrix
  $.transform = matrix3 tm.row1 tm.row3 -tm.row2 tm.row4

Looking at the LDraw documentation I found this:

[i][b]x y z[/b] is the x y z coordinate of the part
[b]a b c d e f g h i[/b] is a top left 3x3 matrix of a standard 4x4 homogeneous transformation matrix[/i]

So, the previous code seems to work, but the whole model is build along the wrong axis.
To fix it I think the following line of code should be all you need to correctly import the models:

<node>.transform = rotatex (matrix3 [a,b,c] [g,h,i] -[d,e,f] [x,y,z]) -90
Page 2 / 2