this question relates to the performance usage of the Inverse Matrix function in VEX, compared to others.
As an example, I have an object that is mapped in the @P attribute. I want to join the object, I call it "Child", with a matrix "Parent" by a multiplication, so that Child is transformed together with the parent matrix:
#include "math.h" // Parent xform components. vector t = chv("t"); vector r = chv("r"); vector s = chv("s"); // Create a matrix from the parent components. matrix M = maketransform(XFORM_SRT, XFORM_XYZ, t, r, s); // Pair child (P) with parent (M). @P *= M;
Now, if I want to make specific changes to the child, I have to detach it from its parent, manipulate it and reattach it again. VEX offers several ways to do so. I'm just asking which one is more efficient.
One of them is to make an inverse matrix by using the function maketransform:
// Inverted parent matrix M. matrix M_inv = maketransform(XFORM_TRS, XFORM_ZYX, -t, -r, s); // Get child out of parent. @P *= M_inv;
Or even more comfortable directly via the invert function. The advantage here is that no additional information about the order of the transformation must be given. But as far as I know an algorithm is used here, which takes possibly more performance to the above variant.
@P *= invert(M);
Such things are not clear and rarely available in the documentation.