XSIMath.CreateMatrix3
 
 
 

XSIMath.CreateMatrix3

Description

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

| m0 m1 m2 |

| m3 m4 m5 |

| m6 m7 m8 |

C# Syntax

SIMatrix3 XSIMath.CreateMatrix3( 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 );

Scripting Syntax

oReturn = XSIMath.CreateMatrix3( [m0_or_Array], [m1], [m2], [m3], [m4], [m5], [m6], [m7], [m8] );

Return Value

SIMatrix3

Parameters

Parameter Type Description
m0_or_Array Double or Array The m0 value or an array (1d or 2d) containing the 9 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.

Examples

1. JScript Example

/* Set and display the values of a matrix3
*/
var oMat3 = XSIMath.CreateMatrix3 (4.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 2.0);
vbArr = new VBArray( oMat3.Get2() );
array = vbArr.toArray();
var lineSize = 3;
//Display Matrix
Application.LogMessage( "The 9 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 9 matrix values
//INFO : m00 4  m01 0  m02 0  
//INFO : m10 0  m11 3  m12 0  
//INFO : m20 0  m21 0  m22 2

2. VBScript Example

'test 2d matrix
dim aValues2d( 3, 3)
aValues2d(0,0) = 1.1
aValues2d(0,1) = 2
aValues2d(0,2) = 3
aValues2d(1,0) = 4.2
aValues2d(1,1) = 5
aValues2d(1,2) = 6
aValues2d(2,0) = 7.1
aValues2d(2,1) = 8
aValues2d(2,2) = 9
set oMatArray2d = XSIMath.CreateMatrix3(aValues2d)
lineSize = 3
Application.LogMessage "The 9 matrix values"
dim mgsString
for i = 0 to lineSize - 1
for j = 0 to lineSize - 1
mgsString = mgsString + " m" & i & j & " " & oMatArray2d(i, j)
next
Application.LogMessage mgsString
mgsString = ""
next
'Expected output:
'INFO : The 9 matrix values
'INFO :  m00 1.1 m01 2 m02 3
'INFO :  m10 4.2 m11 5 m12 6
'INFO :  m20 7.1 m21 8 m22 9