XSIMath.CreateMatrix4

Description

Returns a SIMatrix4 object, the values of this matrix4 can be set at creation time from an array (1d or 2d) or by 16 values.

| m0 m1 m2 m3 |

| m4 m5 m6 m7 |

| m8 m9 m10 m11 |

| m12 m13 m14 m15 |

C# Syntax

SIMatrix4 XSIMath.CreateMatrix4( Object in_d0, Object in_d1, Object in_d2, Object in_d3, Object in_d4, Object in_d5, Object in_d6, Object in_d7, Object in_d8, Object in_d9, Object in_d10, Object in_d11, Object in_d12, Object in_d13, Object in_d14, Object in_d15 );

Scripting Syntax

oReturn = XSIMath.CreateMatrix4( [m0], [m1], [m2], [m3], [m4], [m5], [m6], [m7], [m8], [m9], [m10], [m11], [m12], [m13], [m14], [m15] );

Return Value

SIMatrix4

Parameters

Parameter Type Description
m0 Double or Array The m0 value or an array (1d or 2d) containing the 16 values.
m1 Double The m1 value.
m2 Double The m2 value.
m3 Double The m3 value.
m4 Double The m4 value.
m5 Double The m5 value.
m6 Double The m6 value.
m7 Double The m7 value.
m8 Double The m8 value.
m9 Double The m9 value.
m10 Double The m10 value.
m11 Double The m11 value.
m12 Double The m12 value.
m13 Double The m13 value.
m14 Double The m14 value.
m15 Double The m15 value.

Examples

1. JScript Example

/* Set and display the values of a matrix4
*/
var arrayInit = new Array (16)
arrayInit[0]  = 1.1;
arrayInit[1]  = 2.31;
arrayInit[2]  = 3.7;
arrayInit[3]  = 4;
arrayInit[4]  = 1.2;
arrayInit[5]  = 2.28;
arrayInit[6]  = 5.3;
arrayInit[7]  = 2;
arrayInit[8]  = 1.2;
arrayInit[9]  = 2.88;
arrayInit[10] = 3.4;
arrayInit[11] = 9;
arrayInit[12] = 1.9;
arrayInit[13] = 2.89;
arrayInit[14] = 3.5;
arrayInit[15] = 5;
var oMat4 = XSIMath.CreateMatrix4 (arrayInit);
vbArr = new VBArray( oMat4.Get2() );
array = vbArr.toArray();
//Display Matrix
var lineSize = 4;
Application.LogMessage( "The 16 matrix values" );
var mgsString = "";
for (i =0; i < lineSize; i++ )
{
for (j = 0; j < lineSize; j++ )
mgsString += "m" + i + "" + j + " " + array[ i*lineSize + j ] + "  ";
Application.LogMessage ( mgsString );
mgsString = "";
}		
//Expected output:
//INFO : The 16 matrix values
//INFO : m00 1.1  m01 2.31  m02 3.7  m03 4  
//INFO : m10 1.2  m11 2.28  m12 5.3  m13 2  
//INFO : m20 1.2  m21 2.88  m22 3.4  m23 9  
//INFO : m30 1.9  m31 2.89  m32 3.5  m33 5

2. VBScript Example

set oMatrix4 = XSIMath.CreateMatrix4
Application.LogMessage TypeName(oMatrix4)