Open
Description
It seems that the mult_matrix_4 function is showing some odd behavior. I defined a 4x4 transformation matrix that should move a shape up by 3 units and then rotate that shape by pi/7 radians about the point (0, 3.5, 0) and about the axis (0,0,1):
tmat = [[ 0.90096887 -0.43388374 0. 0.21694187]
[ 0.43388374 0.90096887 0. 3.04951557]
[ 0. 0. 1. 0. ]
[ 0. 0. 0. 1. ]]
I then flattened the matrix in row-major format, as mult_matrix_4 seems to require:
formatted_tmat = [0.9009688679024191, -0.4338837391175581, 0.0, 0.21694186955877903, 0.4338837391175581, 0.9009688679024191, 0.0, 3.0495155660487905, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
I then made a box in pyPolyCSG and applied the transformation:
a = csg.box(3.0,1.0,1.0)
b = a.mult_matrix_4(formatted_tmat)
In terms of the first 4 vertices (as returned by b.get_vertices()), I get what seems to be a translation + dilation of my shape:
[0.21694187, 3.04951557, 0]
[1.61819726, 3.04951557, 0]
[1.61819726, 4.38436817, 0]
[0.21694187, 4.38436817, 0]
I was expecting to get a translation + rotation of the box, as I do when I multiply the vertex coordinates by the transformation matrix by hand:
[0.216942, 3.04952, 0.]
[2.91985, 4.35117, 0.]
[2.48596, 5.25214, 0]
[-0.216942, 3.95048, 0]
Do you know what's causing the discrepancy, and do you know how I can fix it?
Metadata
Metadata
Assignees
Labels
No labels