SIMatrix3.TransposeInverse
 
 
 

SIMatrix3.TransposeInverse

Description

Sets this matrix to the transpose of the inverse of the input matrix m (if not singular): this = Transpose(m^-1)

C# Syntax

Int32 SIMatrix3.TransposeInverse( SIMatrix3 in_pMatrix );

Scripting Syntax

oBoolean = SIMatrix3.TransposeInverse( m );

Return Value

Boolean True if the matrix m has been inverted (not singular); otherwise False.

Parameters

Parameter Type Description
m SIMatrix3 Matrix operand

Examples

1. VBScript Example

dim m1, m2
' Create 3x3 matrices.
set m1 = XSIMath.CreateMatrix3(2.0, 3.0, 0.0, 1.0, 4.0, 0.0, 0.0, 0.0, 1.0)
set m2 = XSIMath.CreateMatrix3
if m2.TransposeInverse( m1 ) then
'do something
else
'do another thing
end if

2. JScript Example

NewScene (null, false);
var oRoot = Application.ActiveProject.ActiveScene.Root
// Create two cubes, the first one is rotated by 45 degrees and second
// is the transpose inverse of the first one="SIMatrix4.TransposeInverseInPlace
var oCube = oRoot.AddGeometry("Cube","MeshSurface", "CubeParent")       
var oCube2 = oRoot.AddGeometry("Cube","MeshSurface", "CubeParent")      
var oTrans = oCube.Kinematics.Local.Transform
var oTrans2 = oCube2.Kinematics.Local.Transform
var oMat3 = XSIMath.CreateMatrix3()
oTrans2.GetRotationMatrix3 ( oMat3 );
// Modify the matrix to scale and rotate around z
oMat3.value(0,0) = 2 * Math.cos (45);
oMat3.value(0,1) = -2 * Math.sin (45);
oMat3.value(1,1) = 2 * Math.cos (45);
oMat3.value(1,0) = 2 * Math.sin (45);
oTrans.SetRotationFromMatrix3 ( oMat3 );        
oCube.Kinematics.Local.Transform = oTrans;
var vbArr = new VBArray( oMat3.Get2() );
var array = vbArr.toArray();
Application.LogMessage( "SIMatrix3 before transpose " +
        " m00:" + array[0] + " m01:" + array[1] + " m02:" + array[2] + 
        " m10:" + array[3] + " m11:" + array[4] + " m12:" + array[5] + 
        " m20:" + array[6] + " m21:" + array[7] + " m22:" + array[8] );
var oMat3Trans = XSIMath.CreateMatrix3()
oMat3Trans.TransposeInverse(oMat3)
oTrans2.SetRotationFromMatrix3 ( oMat3Trans );
var vbArr = new VBArray( oMat3Trans.Get2() );
var array = vbArr.toArray();
Application.LogMessage( "SIMatrix3 after transpose " +
        " m00:" + array[0] + " m01:" + array[1] + " m02:" + array[2] + 
        " m10:" + array[3] + " m11:" + array[4] + " m12:" + array[5] + 
        " m20:" + array[6] + " m21:" + array[7] + " m22:" + array[8] );
oCube2.Kinematics.Local.Transform = oTrans2;
// Expected results:
//INFO : SIMatrix3 before transpose  
//                      m00:1.0506439776354594  m01:-1.7018070490682368 m02:0 
//                      m10:1.7018070490682368  m11:1.0506439776354594  m12:0 
//                      m20:0                   m21:0                   m22:1
//INFO : SIMatrix3 after transpose  
//                      m00:0.26266099440886486 m01:-0.4254517622670592 m02:0 
//                      m10:0.4254517622670592  m11:0.26266099440886486 m12:0 
//                      m20:0                   m21:0                   m22:1

See Also

SIMatrix3.TransposeInverseInPlace SIVector3 SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion