SITransformation.Matrix4
 
 
 

SITransformation.Matrix4

Introduced

v5.1

Description

Sets or returns the SIMatrix4 representation of the values of this transformation (the matrix is created automatically).

C# Syntax

// get accessor
SIMatrix4 rtn = ISITransformation.Matrix4;
// set accessor
ISITransformation.Matrix4 = SIMatrix4;

Examples

JScript Example

/*
        This example demonstrates how to use the Matrix4 property to return the matrix representation 
        of the transformation as an SIMatrix4 (without having to explicitly create it first) as well as 
        how to set new values for the transformation using a 4x4 matrix.
*/
var t1 = XSIMath.CreateTransform();
// The Matrix4 property takes care of creating oMat4 as an SIMatrix4 of the transformation
var oMat4 = t1.Matrix4;
// Now set some values on the matrix and then save it back onto the transformation
oMat4.Set(4.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0);
t1.Matrix4 = oMat4;
// Get a new matrix
var oMat4Dest = t1.Matrix4;
vbArr = new VBArray( oMat4Dest.Get2() );
jsArr = vbArr.toArray();
// Display Matrix
var lineSize = 4;
Application.LogMessage( "The 16 matrix values" );
for ( i=0; i<lineSize; i++ ) {
        var mgsString  = "";
        for ( j=0; j<lineSize; j++ ) {
                mgsString += "m" + i + "" + j + " " + jsArr[ i*lineSize + j ] + "  ";
        }
        Application.LogMessage ( mgsString );
}
// Expected results:
//INFO : The 16 matrix values
//INFO : m00 4  m01 0  m02 0  m03 0  
//INFO : m10 0  m11 3  m12 0  m13 0  
//INFO : m20 0  m21 0  m22 2  m23 0  
//INFO : m30 0  m31 0  m32 0  m33 1

See Also

SITransformation.GetMatrix4 SITransformation.SetMatrix4