I have an issue where the inverse matrix function seems to cause a problem with reset xform. The object will rotate when the reset xform is collapsed.
I’ve created a test case based on one of the matrices that seems to be problematic. I’m creating thousands of meshes using this basic technique and it works without issue 98% of the time. This is the matrix of one of the problem cases. The matrix is created by crossing two orthogonal edges of a polygon. The matrix isn’t perfect, but the error seems to be tiny. I’ve tried to orhogonalize the matrix, but it makes no difference.
The error in rotation after reset xform is huge compared to whatever error was in the matrix. Is there a way to fix this?
clearlistener() thebox = box size:100 thebox.name = "box" theboxortho = copy thebox theboxortho.name = "box ortho" thematrix = matrix3 [-0.000001525883,1.000000000000,0.000000000000] [0.000000000000,0.000000000000,1.000000000000] [1.000000000000,0.000001525883,0.000000000000] [0,0,0] debugpoint = point size:25 box:false axistripod:true cross:false centermarker:false debugpoint.transform = thematrix debugpoint.wirecolor = green debugpoint.name = "point - thematrix" thematrixortho = thematrix orthogonalize thematrixortho format "thematrix = %\n" (thematrix) format "thematrix ortho = %\n" (thematrixortho) format "(thematrix == themtarixortho) = %\n" (thematrix == thematrixortho) thematrixinverse = inverseHighPrecision thematrix thematrixorthoinverse = inverseHighPrecision thematrixortho thebox.transform = thematrixinverse theboxortho.transform = thematrixorthoinverse -- this works fine, so it's the inverse of the matrix that becomes a problem with reset xform --thebox.transform = thematrix --theboxortho.transform = thematrixortho theboxprereset = copy thebox theboxprereset.name = "box pre reset xform" theboxorthoprereset = copy theboxortho theboxorthoprereset.name = "box ortho pre reset xform" resetxform thebox collapsestack thebox resetxform theboxortho collapsestack theboxortho