Sets this matrix to the transpose of the inverse of itself (if not singular): this = Transpose(this^-1)
Int32 SIMatrix4.TransposeInverseInPlace(); |
oBoolean = SIMatrix4.TransposeInverseInPlace(); |
Boolean True if the matrix m has been inverted (not singular); otherwise False.
'
' This example demonstrates how to transpose and invert
' a 4x4 matrix, store the result of the operation in
' the first matrix, and then trap whether the invert
' and transpose operation was successful.
'
dim m1 : set m1 = XSIMath.CreateMatrix4(_
2.0, 3.0, 0.0, 0.0, _
1.0, 4.0, 0.0, 0.0, _
0.0, 0.0, 1.0, 0.0, _
0.0, 0.0, 0.0, 1.0)
if m1.TransposeInverseInPlace then
Application.LogMessage "Success :-D"
else
Application.LogMessage "Failure :-("
end if
' Expected result:
' INFO : Success :-D
|
/*
Create two cubes, the first one uses Matrix4.Set function and
the second uses the transpose inverse matrix of the first
*/
NewScene(null, false);
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oCube = oRoot.AddGeometry("Cube", "MeshSurface", "CubeOriginal");
var oCube2 = oRoot.AddGeometry("Cube", "MeshSurface", "CubeTransposed");
var oTrans = oCube.Kinematics.Local.Transform;
var oTrans2 = oCube2.Kinematics.Local.Transform;
// Change the cube shape
var oMat4 = XSIMath.CreateMatrix4(
1.0, 1.0, 0.0, 10.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
);
// Original cube
oTrans.SetMatrix4(oMat4);
oCube.Kinematics.Local.Transform = oTrans;
// Transpose inverse cube
oMat4.TransposeInverseInPlace();
oTrans2.SetMatrix4(oMat4);
oCube2.Kinematics.Local.Transform = oTrans2;
|