Difference between revisions of "IC Python API:RLPy RMatrix3"

From Reallusion Wiki!
Jump to: navigation, search
m
m
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
{{last_modified}}
 
{{last_modified}}
  
== Detailed Description ==
+
== Description ==
  
This class represent the 3x3 matrix. iClone uses row-major order where consecutive elements of a row reside next to each other, and the data is read from left to right, top to bottom, in a vertical zig-zag. This class provides access to RLPy's internal 3x3 matrix operators and related functions.
+
This class represent a standard 3x3 matrix. This class provides access to RLPy's internal 3x3 matrix operators and related functions. iClone uses row-major order where consecutive elements of a row reside next to each other, and the data is read from left to right, top to bottom, in a vertical zig-zag:
 +
 
 +
  [0, 1, 2]
 +
[3, 4, 5]
 +
[6, 7, 8]
 +
 
 +
== Constructor & Destructor ==
 +
 
 +
=== __init__(self, fM00, fM01, fM02, fM10, fM11, fM12, fM20, fM21, fM22) ===
 +
 
 +
The constructor. Initialize a new 3x3 matrix with another [[IC_Python_API:RLPy_RMatrix3|RMatrix3]] object.
 +
 
 +
==== Parameters ====
 +
:'''fM00''' [IN] Initialization value - float
 +
:'''fM01''' [IN] Initialization value - float
 +
:'''fM02''' [IN] Initialization value - float
 +
:'''fM10''' [IN] Initialization value - float
 +
:'''fM11''' [IN] Initialization value - float
 +
:'''fM12''' [IN] Initialization value - float
 +
:'''fM20''' [IN] Initialization value - float
 +
:'''fM21''' [IN] Initialization value - float
 +
:'''fM22''' [IN] Initialization value - float
 +
 
 +
==== Returns ====
 +
:Returns the row vector of the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
matrix3 = RLPy.RMatrix3( 1, 0, 0,
 +
                        0, 2, 0,
 +
                        0, 0, 3 )
 +
</syntaxhighlight>
 +
 
 +
=== __init__(self, fM00, fM11, fM22) ===
 +
 
 +
The constructor. Initialize a new 3x3 matrix with RMatrix3[0,0], RMatrix3[1,1], RMatrix3[2,2].
 +
 
 +
==== Parameters ====
 +
:'''fM00''' [IN] Initialization value - float
 +
:'''fM11''' [IN] Initialization value - float
 +
:'''fM22''' [IN] Initialization value - float
 +
 
 +
==== Returns ====
 +
:Returns the row vector of the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
matrix3_init = RLPy.RMatrix3(1,2,3)
 +
matrix3 = RLPy.RMatrix3( 1, 0, 0,
 +
                        0, 2, 0,
 +
                        0, 0, 3 )
 +
 
 +
print( matrix3_init == matrix3 ) # true
 +
</syntaxhighlight>
 +
 
 +
=== __init__(self, args) ===
 +
 
 +
The constructor. Initialize a new 3x3 matrix with another [[IC_Python_API:RLPy_RMatrix3|RMatrix3]] object.
 +
 
 +
==== Parameters ====
 +
:'''args''' [IN] A 3X3 matrix object - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
==== Returns ====
 +
:Returns the row vector of the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
matrix3 = RLPy.RMatrix3( 1, 0, 0,
 +
                        0, 2, 0,
 +
                        0, 0, 3 )
 +
matrix3_copy = RLPy.RMatrix3(matrix3)                     
 +
print( matrix3_copy == matrix3 ) # true
 +
</syntaxhighlight>
 +
 
 +
=== __init__(self, rAxis, fAngle) ===
 +
 
 +
The constructor. Initialize a new 3x3 matrix with [[IC_Python_API:RLPy_RVector3|RVector3]] axis object and angle.
 +
 
 +
==== Parameters ====
 +
:'''rAxis''' [IN]  a [[IC_Python_API:RLPy_RVector3|RVector3]] object - [[IC_Python_API:RLPy_RVector3|RVector3]] 
 +
:'''fAngle''' [IN] a float object - float
 +
 
 +
==== Returns ====
 +
:Returns the row vector of the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
matrix3 = RLPy.RMatrix3( RLPy.RVector3( 1, 0, 0 ), 3 )
 +
</syntaxhighlight>
  
 
== Operators ==
 
== Operators ==
Line 13: Line 97:
 
The "addition" operator.
 
The "addition" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#+=|+=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 21: Line 107:
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3_result = matrix3_a + matrix3_b
 
matrix3_result = matrix3_a + matrix3_b
 +
 
print( matrix3_result.GetRow(0)[0] == 1+2 ) # true
 
print( matrix3_result.GetRow(0)[0] == 1+2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2+2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2+2 ) # true
Line 30: Line 117:
 
The "subtraction" operator.
 
The "subtraction" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#-=|-=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 38: Line 127:
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3_result = matrix3_a - matrix3_b
 
matrix3_result = matrix3_a - matrix3_b
 +
 
print( matrix3_result.GetRow(0)[0] == 1-2 ) # true
 
print( matrix3_result.GetRow(0)[0] == 1-2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2-2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2-2 ) # true
Line 47: Line 137:
 
The "multiplication" operator.
 
The "multiplication" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#*=|*=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 62: Line 154:
 
The "division" operator.  
 
The "division" operator.  
  
<syntaxhighlight lang="Python">
+
See Also: [[#/=|/=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3_result = matrix3_a / 2
 
matrix3_result = matrix3_a / 2
 +
 
print( matrix3_result.GetRow(0)[0] == 1/2 ) # true
 
print( matrix3_result.GetRow(0)[0] == 1/2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2/2 ) # true
 
print( matrix3_result.GetRow(0)[1] == 2/2 ) # true
Line 74: Line 169:
 
=== - ===
 
=== - ===
  
The "unary minus" .
+
The "unary minus" operator.
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3_result = -matrix3_a
 
matrix3_result = -matrix3_a
 +
 
print( matrix3_result.GetRow(0)[0] == -1 ) # true
 
print( matrix3_result.GetRow(0)[0] == -1 ) # true
 
print( matrix3_result.GetRow(0)[1] == -2 ) # true
 
print( matrix3_result.GetRow(0)[1] == -2 ) # true
Line 90: Line 186:
 
The "equal to" operator. Performs a one-by-one comparison of the matrix array.
 
The "equal to" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#!=|!=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 104: Line 202:
 
The "not equal to" operator. Performs a one-by-one comparison of the matrix array.
 
The "not equal to" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#==|==]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 118: Line 218:
 
The "greater than" operator. Performs a one-by-one comparison of the matrix array.
 
The "greater than" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#>=|>=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 2, 0, 0,
 
matrix3_a = RLPy.RMatrix3( 2, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 132: Line 234:
 
The "greater than or equal to" operator. Performs a one-by-one comparison of the matrix array.
 
The "greater than or equal to" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#>|>]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 1, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 1, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 146: Line 250:
 
The "less than" operator. Performs a one-by-one comparison of the matrix array.
 
The "less than" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#<=|<=]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 2, 0, 0,
 
matrix3_a = RLPy.RMatrix3( 2, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 160: Line 266:
 
The "less than" operator. Performs a one-by-one comparison of the matrix array.
 
The "less than" operator. Performs a one-by-one comparison of the matrix array.
  
<syntaxhighlight lang="Python">
+
See Also: [[#<|<]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_a = RLPy.RMatrix3( 1, 1, 3,
 
matrix3_a = RLPy.RMatrix3( 1, 1, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 174: Line 282:
 
The "addition assignment" operator.
 
The "addition assignment" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#+|+]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 181: Line 291:
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 +
 
print( matrix3.GetRow(0)[0] == 1+2 ) # true
 
print( matrix3.GetRow(0)[0] == 1+2 ) # true
 
print( matrix3.GetRow(0)[1] == 2+2 ) # true
 
print( matrix3.GetRow(0)[1] == 2+2 ) # true
Line 190: Line 301:
 
The "subtraction assignment" operator.
 
The "subtraction assignment" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#-|-]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
Line 197: Line 310:
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 +
 
print( matrix3.GetRow(0)[0] == 1-2 ) # true
 
print( matrix3.GetRow(0)[0] == 1-2 ) # true
 
print( matrix3.GetRow(0)[1] == 2-2 ) # true
 
print( matrix3.GetRow(0)[1] == 2-2 ) # true
Line 204: Line 318:
 
=== *= ===
 
=== *= ===
  
The "multiplication assignment" operator.  For the calculation method, refer to the '''*''' operator.
+
The "multiplication assignment" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#*|*]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3 *= 2
 
matrix3 *= 2
 +
 
print( matrix3.GetRow(0)[0] == 1*2 ) # true
 
print( matrix3.GetRow(0)[0] == 1*2 ) # true
 
print( matrix3.GetRow(0)[1] == 2*2 ) # true
 
print( matrix3.GetRow(0)[1] == 2*2 ) # true
Line 218: Line 335:
 
=== /= ===
 
=== /= ===
  
The "division assignment" operator. For the calculation method, refer to the '''/''' operator.
+
The "division assignment" operator.
  
<syntaxhighlight lang="Python">
+
See Also: [[#/|/]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 
                           0, 0, 0,
 
                           0, 0, 0,
 
                           0, 0, 0 )
 
                           0, 0, 0 )
 
matrix3 /= 2
 
matrix3 /= 2
 +
 
print( matrix3.GetRow(0)[0] == 1/2 ) # true
 
print( matrix3.GetRow(0)[0] == 1/2 ) # true
 
print( matrix3.GetRow(0)[1] == 2/2 ) # true
 
print( matrix3.GetRow(0)[1] == 2/2 ) # true
Line 236: Line 356:
 
This function can be used to initialize the 3x3 matrix.  It is equivalent to setting the matrix to:
 
This function can be used to initialize the 3x3 matrix.  It is equivalent to setting the matrix to:
  
:[1 0 0 0]
+
[1 0 0]
:[0 1 0 0]
+
[0 1 0]
:[0 0 1 0]
+
[0 0 1]
:[0 0 0 1]
+
  
 
==== Returns ====
 
==== Returns ====
  
This object - RLPy.RMatrix3
+
This object - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3 = RLPy.RMatrix3()
 
matrix3 = RLPy.RMatrix3()
 
matrix3.MakeIdentity()
 
matrix3.MakeIdentity()
Line 259: Line 378:
  
 
==== Returns ====
 
==== Returns ====
:Returns the matrix element specified by row and col - float*
+
:The matrix element specified by row and column - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3 = RLPy.RMatrix3()
 
matrix3 = RLPy.RMatrix3()
 
matrix3.MakeIdentity()
 
matrix3.MakeIdentity()
Line 276: Line 395:
  
 
==== Returns ====
 
==== Returns ====
:Returns the matrix element specified by index - float*
+
:The matrix element specified by index - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3 = RLPy.RMatrix3()
 
matrix3 = RLPy.RMatrix3()
 
matrix3.MakeIdentity()
 
matrix3.MakeIdentity()
Line 287: Line 406:
 
=== GetRow ( self, nRow ) ===
 
=== GetRow ( self, nRow ) ===
  
Obtain an array of element values within a given row inside a 3x3 matrix.
+
Retreive a row inside a 3x3 matrix.
  
 
==== Parameters ====
 
==== Parameters ====
Line 293: Line 412:
  
 
==== Returns ====
 
==== Returns ====
:Returns the row vector of the matrix - RLPy.RVector3
+
:The row vector of the matrix - [[IC_Python_API:RLPy_RVector3|RVector3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3 = RLPy.RMatrix3()
 
matrix3 = RLPy.RMatrix3()
 
matrix3.MakeIdentity()
 
matrix3.MakeIdentity()
Line 307: Line 426:
 
=== GetColumn( self, nCol ) ===
 
=== GetColumn( self, nCol ) ===
  
Obtain an array of element values within a given column inside a 3x3 matrix.
+
Retreive a column inside a 3x3 matrix.
  
 
==== Parameters ====
 
==== Parameters ====
Line 313: Line 432:
  
 
==== Returns ====
 
==== Returns ====
:Returns the column vector of the matrix - RLPy.RVector3
+
:The column vector of the matrix - [[IC_Python_API:RLPy_RVector3|RVector3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3 = RLPy.RMatrix3()
 
matrix3 = RLPy.RMatrix3()
 
matrix3.MakeIdentity()
 
matrix3.MakeIdentity()
 
col0 = matrix3.GetColumn(0)
 
col0 = matrix3.GetColumn(0)
 +
 
print(col0[0])
 
print(col0[0])
 
print(col0[1])
 
print(col0[1])
Line 329: Line 449:
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix containing this matrix's transpose - RLPy.RMatrix3
+
:A new matrix containing this matrix's transpose - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
                               4, 5, 6,
 
                               4, 5, 6,
Line 349: Line 469:
  
 
==== Parameters ====
 
==== Parameters ====
:'''mM''' [IN] the matrix - RLPy.RMatrix3
+
:'''mM''' [IN] the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix. (this^T * mM) - RLPy.RMatrix3
+
:A new matrix. (this^T * mM) - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
                               4, 5, 6,
 
                               4, 5, 6,
Line 372: Line 492:
 
=== TimesTranspose( self, mM ) ===
 
=== TimesTranspose( self, mM ) ===
  
Multiply a given 3x3 matrix with a transposed version of itself.
+
Multiply this 3x3 matrix with a transposed version of itself.
  
 
==== Parameters ====
 
==== Parameters ====
:'''mM'''  [IN] the matrix - RLPy.RMatrix3
+
:'''mM'''  [IN] the matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix. (this * M^T) - RLPy.RMatrix3
+
:A new matrix. (this * M^T) - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 
                               4, 5, 6,
 
                               4, 5, 6,
Line 398: Line 518:
 
=== Inverse( self ) ===
 
=== Inverse( self ) ===
  
Invert a given 3x3 matrix.
+
Obtain the inverse (reciprocal) of this 3x3 matrix (A^-1).
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix containing this matrix's inverse - RLPy.RMatrix3
+
:A new matrix containing this matrix's inverse - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
                               2, 3, 4,
 
                               2, 3, 4,
Line 409: Line 529:
 
matrix3_inverse = matrix3_value.Inverse()
 
matrix3_inverse = matrix3_value.Inverse()
 
row0 = matrix3_inverse.GetRow(0)
 
row0 = matrix3_inverse.GetRow(0)
 +
 
print(row0[0])
 
print(row0[0])
 
print(row0[1])
 
print(row0[1])
Line 416: Line 537:
 
=== Adjoint( self ) ===
 
=== Adjoint( self ) ===
  
Adjugate a given 3x3 matrix.
+
Adjugate this 3x3 matrix.
  
<syntaxhighlight lang="Python">
+
==== Returns ====
 +
:A new matrix containing this matrix's adjoint - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
                               2, 3, 4,
 
                               2, 3, 4,
Line 429: Line 553:
 
print(row0[2])
 
print(row0[2])
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== Returns ====
 
 
Returns a new matrix containing this matrix's adjoint - RLPy.RMatrix3
 
  
 
=== AdjointTranspose( self ) ===
 
=== AdjointTranspose( self ) ===
  
Adjugate and transpose a given 3x3 matrix.
+
Adjugate and transpose this 3x3 matrix.
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix - RLPy.RMatrix3
+
:A new adjugated and transposed matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
                               2, 3, 4,
 
                               2, 3, 4,
Line 455: Line 575:
 
=== InverseTranspose( self ) ===
 
=== InverseTranspose( self ) ===
  
Invert and transpose a given 3x3 matrix.
+
Invert and transpose this 3x3 matrix.
  
 
==== Returns ====
 
==== Returns ====
:Returns a new matrix - RLPy.RMatrix3
+
:A new inverted and transposed matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
                               2, 3, 4,
 
                               2, 3, 4,
Line 474: Line 594:
 
=== Determinant( self ) ===
 
=== Determinant( self ) ===
  
Obtain the scalar value for a given 3x3 matrix.
+
Obtain the scalar value for this 3x3 matrix (|A|).
  
 
==== Returns ====
 
==== Returns ====
:Returns the determinant of the matrix - float
+
:The determinant of the matrix - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
matrix3_value = RLPy.RMatrix3( 1, 2, 3,
 
                               2, 3, 4,
 
                               2, 3, 4,
Line 489: Line 609:
 
=== MaxColumn( self ) ===
 
=== MaxColumn( self ) ===
  
Find the maximum absolute value within a 3x3 matrix, and return the column in which the value is located.  If all of the elements within the 3x3 matrix are 0 then return -1.
+
Find the maximum absolute value within this 3x3 matrix, and return the column in which the value is located.  If all of the elements within the 3x3 matrix are 0 then return -1.
  
 
==== Returns ====
 
==== Returns ====
:Return index of column of M containing maximum abs entry, or -1 if M = 0 - int
+
:Index of column of M containing maximum abs entry, or -1 if M = 0 - int
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 10, 20, -30,
 
matrix3_value = RLPy.RMatrix3( 10, 20, -30,
 
                                 0,  0,  0,
 
                                 0,  0,  0,
Line 504: Line 624:
 
=== MaxRow( self ) ===
 
=== MaxRow( self ) ===
  
Find the maximum absolute value within a 3x3 matrix, and return the row in which the value is located.  If all of the elements within the 3x3 matrix are 0 then return -1.
+
Find the maximum absolute value within this 3x3 matrix, and return the row in which the value is located.  If all of the elements within the 3x3 matrix are 0 then return -1.
  
 
==== Returns ====
 
==== Returns ====
:Return index of row of M containing maximum abs entry, or -1 if M = 0 - int
+
:Index of row of M containing maximum abs entry, or -1 if M = 0 - int
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 10, 0, 0,
 
matrix3_value = RLPy.RMatrix3( 10, 0, 0,
 
                               20, 0, 0,
 
                               20, 0, 0,
 
                               -30, 0, 0 )
 
                               -30, 0, 0 )
 
 
print(matrix3_value.MaxRow()) # Row:2 ->abs(-30)
 
print(matrix3_value.MaxRow()) # Row:2 ->abs(-30)
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 522: Line 641:
  
 
==== Returns ====
 
==== Returns ====
:Return Norm - float
+
:Norm of this 3x3 matrix - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_row_value = RLPy.RMatrix3( 10, 0, 0,
 
matrix3_row_value = RLPy.RMatrix3( 10, 0, 0,
 
                                   20, 0, 0,
 
                                   20, 0, 0,
 
                                   -30, 0, 0 )
 
                                   -30, 0, 0 )
 
 
print(matrix3_row_value.OneNorm()) # 10+20+abs(-30) = 60
 
print(matrix3_row_value.OneNorm()) # 10+20+abs(-30) = 60
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 537: Line 655:
  
 
==== Returns ====
 
==== Returns ====
:Return InfNorm - float
+
:InfNorm of this 3x3 matrix - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_column_value = RLPy.RMatrix3( 10, 20, -30,
 
matrix3_column_value = RLPy.RMatrix3( 10, 20, -30,
 
                                       0,  0,  0,
 
                                       0,  0,  0,
 
                                       0,  0,  0 )
 
                                       0,  0,  0 )
 
 
print(matrix3_column_value.InfNorm()) # 10+20+abs(-30) = 60
 
print(matrix3_column_value.InfNorm()) # 10+20+abs(-30) = 60
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 552: Line 669:
  
 
==== Parameters ====
 
==== Parameters ====
:'''rkAxis''' [IN] axis vector - RLPy.RVector3
+
:'''rkAxis''' [IN] axis vector - [[IC_Python_API:RLPy_RVector3|RVector3]]
 
:'''fAngle''' [IN] angle in radians - float
 
:'''fAngle''' [IN] angle in radians - float
  
 
==== Returns ====
 
==== Returns ====
:Return a new matrix from specified axis angle - RLPy.RMatrix3
+
:A new matrix from specified axis angle - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin.MakeIdentity()
 
matrix3_orgin.MakeIdentity()
Line 573: Line 690:
 
=== RotationX( self, fAngle ) ===
 
=== RotationX( self, fAngle ) ===
  
Rotation matrix for rotations around x-axis.
+
Rotate this 3x3 matrix around the x-axis.
  
 
==== Parameters ====
 
==== Parameters ====
Line 579: Line 696:
  
 
==== Returns ====
 
==== Returns ====
:Return a new matrix of for rotations around x-axis - RLPy.RMatrix3
+
:The rotated 3x3 matrix around the x-axis - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin.MakeIdentity()
 
matrix3_orgin.MakeIdentity()
Line 589: Line 706:
 
=== RotationY( self, fAngle ) ===
 
=== RotationY( self, fAngle ) ===
  
Rotate a given 3x3 matrix around the y-axis。
+
Rotate this 3x3 matrix around the y-axis。
  
 
==== Parameters ====
 
==== Parameters ====
Line 595: Line 712:
  
 
==== Returns ====
 
==== Returns ====
:Return a new matrix of for rotations around y-axis - RLPy.RMatrix3
+
:The rotated 3x3 matrix around the y-axis - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin.MakeIdentity()
 
matrix3_orgin.MakeIdentity()
Line 605: Line 722:
 
=== RotationZ( self, fAngle ) ===
 
=== RotationZ( self, fAngle ) ===
  
Rotation a given 3x3 matrix around the z-axis.
+
Rotation this 3x3 matrix around the z-axis.
  
 
==== Parameters ====
 
==== Parameters ====
Line 611: Line 728:
  
 
==== Returns ====
 
==== Returns ====
:Return a new 3x3 matrix of for rotations around z-axis - RLPy.RMatrix3
+
:A new 3x3 matrix of for rotations around z-axis - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin.MakeIdentity()
 
matrix3_orgin.MakeIdentity()
Line 624: Line 741:
  
 
==== Parameters ====
 
==== Parameters ====
rkScale [IN] Scale vector - RLPy.RVector3
+
rkScale [IN] Scale vector - [[IC_Python_API:RLPy_RVector3|RVector3]]
  
 
==== Returns ====
 
==== Returns ====
:Return a new matrix - RLPy.RMatrix3
+
:A newly scaled matrix - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin.MakeIdentity()
 
matrix3_orgin.MakeIdentity()
Line 638: Line 755:
 
=== ToEulerAngle( self, rkScaleself, Order, rx, ry, rz ) ===
 
=== ToEulerAngle( self, rkScaleself, Order, rx, ry, rz ) ===
  
Convert matrix to Euler angles.
+
Convert 3x3 matrix to Euler angles.
  
 
==== Parameters ====
 
==== Parameters ====
 
:'''Order''' [IN] Euler order - RLPy.Rotation_Order
 
:'''Order''' [IN] Euler order - RLPy.Rotation_Order
:'''rx''' [OUT] return angle of x-axis in radians - float
+
:'''rx''' [OUT] Angle of x-axis in radians - float
:'''ry''' [OUT] return angle of y-axis in radians - float
+
:'''ry''' [OUT] Angle of y-axis in radians - float
:'''rz''' [OUT] return angle of z-axis in radians - float
+
:'''rz''' [OUT] Angle of z-axis in radians - float
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( -0, -0,  1,
 
matrix3_value = RLPy.RMatrix3( -0, -0,  1,
 
                                 0, -1, -0,
 
                                 0, -1, -0,
Line 662: Line 779:
 
=== FromEulerAngle( self, Order, rx, ry, rz ) ===
 
=== FromEulerAngle( self, Order, rx, ry, rz ) ===
  
Convert Euler angle to a 3x3 matrix.
+
Convert Euler angle to a 3x3 matrix according to a rotation axis order.
  
 
==== Parameters ====
 
==== Parameters ====
 
:'''Order''' [IN] Euler order - RLPy.Rotation_Order
 
:'''Order''' [IN] Euler order - RLPy.Rotation_Order
:'''rx''' [IN] return angle of x-axis in radians - float
+
:'''rx''' [IN] Angle of x-axis in radians - float
:'''ry''' [IN] return angle of y-axis in radians - float
+
:'''ry''' [IN] Angle of y-axis in radians - float
:'''rz''' [IN] return angle of z-axis in radians - float
+
:'''rz''' [IN] Angle of z-axis in radians - float
  
 
==== Returns ====
 
==== Returns ====
:Return a new matrix from specified axis angle - RLPy.RMatrix3
+
:A new matrix from specified axis angle - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_orgin = RLPy.RMatrix3()
 
matrix3_orgin = RLPy.RMatrix3()
 
euler_angle_x = 90 * RLPy.RMath.CONST_DEG_TO_RAD
 
euler_angle_x = 90 * RLPy.RMath.CONST_DEG_TO_RAD
Line 691: Line 808:
  
 
==== Parameters ====
 
==== Parameters ====
:'''rkVec''' [IN] vector - RLPy.RVector3
+
:'''rkVec''' [IN] vector - [[IC_Python_API:RLPy_RVector3|RVector3]]
  
 
==== Returns ====
 
==== Returns ====
:Return a new 3x3 matrix from sphere unit vector - RLPy.RMatrix3
+
:A new 3x3 matrix from sphere unit vector - [[IC_Python_API:RLPy_RMatrix3|RMatrix3]]
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
vector = RLPy.RVector3( 0, 1, 0 )
 
vector = RLPy.RVector3( 0, 1, 0 )
 
matrix3_result =  RLPy.RMatrix3().FromSphereUnitVec( vector )
 
matrix3_result =  RLPy.RMatrix3().FromSphereUnitVec( vector )
Line 708: Line 825:
 
=== IsRightHandCoordinate( self ) ===
 
=== IsRightHandCoordinate( self ) ===
  
Obtain the 3x3 matrix's coordinate system.  '''True''' stands for right-handed coordinate system while ''''False''' for left-handed.
+
Obtain this 3x3 matrix's coordinate system.  '''True''' stands for right-handed coordinate system while '''False''' for left-handed.
  
 
==== Returns ====
 
==== Returns ====
Line 714: Line 831:
 
:'''False''' Left hand coordinate - bool
 
:'''False''' Left hand coordinate - bool
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
 
matrix3_value = RLPy.RMatrix3( 1, 0, 0,
 
matrix3_value = RLPy.RMatrix3( 1, 0, 0,
 
                               0, 1, 0,
 
                               0, 1, 0,

Latest revision as of 23:15, 13 April 2020

Contents

Main article: Modules.
Last modified: 04/13/2020

Description

This class represent a standard 3x3 matrix. This class provides access to RLPy's internal 3x3 matrix operators and related functions. iClone uses row-major order where consecutive elements of a row reside next to each other, and the data is read from left to right, top to bottom, in a vertical zig-zag:

[0, 1, 2]
[3, 4, 5]
[6, 7, 8]

Constructor & Destructor

__init__(self, fM00, fM01, fM02, fM10, fM11, fM12, fM20, fM21, fM22)

The constructor. Initialize a new 3x3 matrix with another RMatrix3 object.

Parameters

fM00 [IN] Initialization value - float
fM01 [IN] Initialization value - float
fM02 [IN] Initialization value - float
fM10 [IN] Initialization value - float
fM11 [IN] Initialization value - float
fM12 [IN] Initialization value - float
fM20 [IN] Initialization value - float
fM21 [IN] Initialization value - float
fM22 [IN] Initialization value - float

Returns

Returns the row vector of the matrix - RMatrix3
1 matrix3 = RLPy.RMatrix3( 1, 0, 0,
2                          0, 2, 0,
3                          0, 0, 3 )

__init__(self, fM00, fM11, fM22)

The constructor. Initialize a new 3x3 matrix with RMatrix3[0,0], RMatrix3[1,1], RMatrix3[2,2].

Parameters

fM00 [IN] Initialization value - float
fM11 [IN] Initialization value - float
fM22 [IN] Initialization value - float

Returns

Returns the row vector of the matrix - RMatrix3
1 matrix3_init = RLPy.RMatrix3(1,2,3)
2 matrix3 = RLPy.RMatrix3( 1, 0, 0,
3                          0, 2, 0,
4                          0, 0, 3 )
5 
6 print( matrix3_init == matrix3 ) # true

__init__(self, args)

The constructor. Initialize a new 3x3 matrix with another RMatrix3 object.

Parameters

args [IN] A 3X3 matrix object - RMatrix3

Returns

Returns the row vector of the matrix - RMatrix3
1 matrix3 = RLPy.RMatrix3( 1, 0, 0,
2                          0, 2, 0,
3                          0, 0, 3 )
4 matrix3_copy = RLPy.RMatrix3(matrix3)                      
5 print( matrix3_copy == matrix3 ) # true

__init__(self, rAxis, fAngle)

The constructor. Initialize a new 3x3 matrix with RVector3 axis object and angle.

Parameters

rAxis [IN] a RVector3 object - RVector3
fAngle [IN] a float object - float

Returns

Returns the row vector of the matrix - RMatrix3
1 matrix3 = RLPy.RMatrix3( RLPy.RVector3( 1, 0, 0 ), 3 )

Operators

+

The "addition" operator.

See Also: +=

 1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 2                            0, 0, 0,
 3                            0, 0, 0 )
 4 matrix3_b = RLPy.RMatrix3( 2, 2, 2,
 5                            0, 0, 0,
 6                            0, 0, 0 )
 7 matrix3_result = matrix3_a + matrix3_b
 8 
 9 print( matrix3_result.GetRow(0)[0] == 1+2 ) # true
10 print( matrix3_result.GetRow(0)[1] == 2+2 ) # true
11 print( matrix3_result.GetRow(0)[2] == 3+2 ) # true

-

The "subtraction" operator.

See Also: -=

 1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
 2                            0, 0, 0,
 3                            0, 0, 0 )
 4 matrix3_b = RLPy.RMatrix3( 2, 2, 2,
 5                            0, 0, 0,
 6                            0, 0, 0 )
 7 matrix3_result = matrix3_a - matrix3_b
 8 
 9 print( matrix3_result.GetRow(0)[0] == 1-2 ) # true
10 print( matrix3_result.GetRow(0)[1] == 2-2 ) # true
11 print( matrix3_result.GetRow(0)[2] == 3-2 ) # true

*

The "multiplication" operator.

See Also: *=

1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 2, 0, 0,
5                            2, 0, 0,
6                            2, 0, 0 )
7 matrix3_result = matrix3_a * matrix3_b
8 print( matrix3_result.GetRow(0)[0] == 1*2 + 2*2 + 3*2 ) # true

/

The "division" operator.

See Also: /=

1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_result = matrix3_a / 2
5 
6 print( matrix3_result.GetRow(0)[0] == 1/2 ) # true
7 print( matrix3_result.GetRow(0)[1] == 2/2 ) # true
8 print( matrix3_result.GetRow(0)[2] == 3/2 ) # true

-

The "unary minus" operator.

1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_result = -matrix3_a
5 
6 print( matrix3_result.GetRow(0)[0] == -1 ) # true
7 print( matrix3_result.GetRow(0)[1] == -2 ) # true
8 print( matrix3_result.GetRow(0)[2] == -3 ) # true

==

The "equal to" operator. Performs a one-by-one comparison of the matrix array.

See Also: !=

1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 1, 2, 3,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_a == matrix3_b ) # true

!=

The "not equal to" operator. Performs a one-by-one comparison of the matrix array.

See Also: ==

1 matrix3_a = RLPy.RMatrix3( 1, 2, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 4, 5, 6,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_a != matrix3_b ) # true

>

The "greater than" operator. Performs a one-by-one comparison of the matrix array.

See Also: >=

1 matrix3_a = RLPy.RMatrix3( 2, 0, 0,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 5, 0, 0,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_b >matrix3_a ) # true

>=

The "greater than or equal to" operator. Performs a one-by-one comparison of the matrix array.

See Also: >

1 matrix3_a = RLPy.RMatrix3( 1, 1, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 1, 1, 9,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_b >= matrix3_a ) # true

<

The "less than" operator. Performs a one-by-one comparison of the matrix array.

See Also: <=

1 matrix3_a = RLPy.RMatrix3( 2, 0, 0,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 5, 0, 0,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_a< matrix3_b ) # true

<=

The "less than" operator. Performs a one-by-one comparison of the matrix array.

See Also: <

1 matrix3_a = RLPy.RMatrix3( 1, 1, 3,
2                            0, 0, 0,
3                            0, 0, 0 )
4 matrix3_b = RLPy.RMatrix3( 1, 1, 9,
5                            0, 0, 0,
6                            0, 0, 0 )
7 print( matrix3_a<= matrix3_b ) # true

+=

The "addition assignment" operator.

See Also: +

 1 matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 2                           0, 0, 0,
 3                           0, 0, 0 )
 4 matrix3 += RLPy.RMatrix3( 2, 2, 2,
 5                           0, 0, 0,
 6                           0, 0, 0 )
 7 
 8 print( matrix3.GetRow(0)[0] == 1+2 ) # true
 9 print( matrix3.GetRow(0)[1] == 2+2 ) # true
10 print( matrix3.GetRow(0)[2] == 3+2 ) # true

-=

The "subtraction assignment" operator.

See Also: -

 1 matrix3 =  RLPy.RMatrix3( 1, 2, 3,
 2                           0, 0, 0,
 3                           0, 0, 0 )
 4 matrix3 -= RLPy.RMatrix3( 2, 2, 2,
 5                           0, 0, 0,
 6                           0, 0, 0 )
 7 
 8 print( matrix3.GetRow(0)[0] == 1-2 ) # true
 9 print( matrix3.GetRow(0)[1] == 2-2 ) # true
10 print( matrix3.GetRow(0)[2] == 3-2 ) # true

*=

The "multiplication assignment" operator.

See Also: *

1 matrix3 =  RLPy.RMatrix3( 1, 2, 3,
2                           0, 0, 0,
3                           0, 0, 0 )
4 matrix3 *= 2
5 
6 print( matrix3.GetRow(0)[0] == 1*2 ) # true
7 print( matrix3.GetRow(0)[1] == 2*2 ) # true
8 print( matrix3.GetRow(0)[2] == 3*2 ) # true

/=

The "division assignment" operator.

See Also: /

1 matrix3 =  RLPy.RMatrix3( 1, 2, 3,
2                           0, 0, 0,
3                           0, 0, 0 )
4 matrix3 /= 2
5 
6 print( matrix3.GetRow(0)[0] == 1/2 ) # true
7 print( matrix3.GetRow(0)[1] == 2/2 ) # true
8 print( matrix3.GetRow(0)[2] == 3/2 ) # true

Member Functions

MakeIdentity ( self )

This function can be used to initialize the 3x3 matrix. It is equivalent to setting the matrix to:

[1 0 0]
[0 1 0]
[0 0 1]

Returns

This object - RMatrix3

1 matrix3 = RLPy.RMatrix3()
2 matrix3.MakeIdentity()

M ( self, args )

Get the value of an element in a 3x3 matrix by row and column index.

Parameters

nRow [IN] Index of the row in the matrix - int
nCol [IN] Index of the column in the matrix - int

Returns

The matrix element specified by row and column - float
1 matrix3 = RLPy.RMatrix3()
2 matrix3.MakeIdentity()
3 
4 print(matrix3.M(0,0))  # <Swig Object of type 'float *' at 0x0000020316B015A0>

E ( self, args )

Get the value of an element in a 3x3 matrix by index number (from 0 to 8);

Parameters

nRow [IN] Index of the matrix.

Returns

The matrix element specified by index - float
1 matrix3 = RLPy.RMatrix3()
2 matrix3.MakeIdentity()
3 
4 print(matrix3.E(0)) #

GetRow ( self, nRow )

Retreive a row inside a 3x3 matrix.

Parameters

nRow [IN] Index of the row in the matrix - int

Returns

The row vector of the matrix - RVector3
1 matrix3 = RLPy.RMatrix3()
2 matrix3.MakeIdentity()
3 row0 = matrix3.GetRow(0)
4 
5 print(row0[0])
6 print(row0[1])
7 print(row0[2])

GetColumn( self, nCol )

Retreive a column inside a 3x3 matrix.

Parameters

nCol [IN] Index of the row in the matrix - int

Returns

The column vector of the matrix - RVector3
1 matrix3 = RLPy.RMatrix3()
2 matrix3.MakeIdentity()
3 col0 = matrix3.GetColumn(0)
4 
5 print(col0[0])
6 print(col0[1])
7 print(col0[2])

Transpose( self )

Obtain the transposed matrix by transposing the current m * n matrix into an n * m matrix by row-column swapping.

Returns

A new matrix containing this matrix's transpose - RMatrix3
 1 matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 2                                4, 5, 6,
 3                                7, 8, 9 )
 4 matrix3_transpose = matrix3_orgin.Transpose()
 5 row0 = matrix3_orgin.GetRow(0)
 6 col0 = matrix3_transpose.GetColumn(0)
 7 
 8 print(row0[0] == col0[0])
 9 print(row0[1] == col0[1])
10 print(row0[2] == col0[2])

TransposeTimes( self, mM )

Multiply a transposed version of a 3x3 matrix with itself.

Parameters

mM [IN] the matrix - RMatrix3

Returns

A new matrix. (this^T * mM) - RMatrix3
 1 matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 2                                4, 5, 6,
 3                                7, 8, 9 )
 4 matrix3_transpose_value = RLPy.RMatrix3( 2, 0, 0,
 5                                          0, 2, 0,
 6                                          0, 0, 2 )
 7 matrix3_transpose_times = matrix3_orgin.TransposeTimes(matrix3_transpose_value)
 8 row0 = matrix3_orgin.GetRow(0)
 9 col0 = matrix3_transpose_times.GetColumn(0)
10 
11 print(row0[0]*2 == col0[0])
12 print(row0[1]*2 == col0[1])
13 print(row0[2]*2 == col0[2])

TimesTranspose( self, mM )

Multiply this 3x3 matrix with a transposed version of itself.

Parameters

mM [IN] the matrix - RMatrix3

Returns

A new matrix. (this * M^T) - RMatrix3
 1 matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
 2                                4, 5, 6,
 3                                7, 8, 9 )
 4 matrix3_transpose_value = RLPy.RMatrix3( 3, 0, 0,
 5                                          0, 3, 0,
 6                                          0, 0, 3 )
 7 matrix3_times_transpose = matrix3_orgin.TimesTranspose(matrix3_transpose_value)
 8 row0 = matrix3_orgin.GetColumn(0)
 9 col0 = matrix3_times_transpose.GetColumn(0)
10 
11 print(row0[0]*3 == col0[0])
12 print(row0[1]*3 == col0[1])
13 print(row0[2]*3 == col0[2])

Inverse( self )

Obtain the inverse (reciprocal) of this 3x3 matrix (A^-1).

Returns

A new matrix containing this matrix's inverse - RMatrix3
1 matrix3_value = RLPy.RMatrix3( 1, 2, 3,
2                                2, 3, 4,
3                                4, 2, 1 )
4 matrix3_inverse = matrix3_value.Inverse()
5 row0 = matrix3_inverse.GetRow(0)
6 
7 print(row0[0])
8 print(row0[1])
9 print(row0[2])

Adjoint( self )

Adjugate this 3x3 matrix.

Returns

A new matrix containing this matrix's adjoint - RMatrix3
1 matrix3_value = RLPy.RMatrix3( 1, 2, 3,
2                                2, 3, 4,
3                                4, 2, 1 )
4 matrix3_Adjoint = matrix3_value.Adjoint()
5 row0 = matrix3_Adjoint.GetRow(0)
6 
7 print(row0[0])
8 print(row0[1])
9 print(row0[2])

AdjointTranspose( self )

Adjugate and transpose this 3x3 matrix.

Returns

A new adjugated and transposed matrix - RMatrix3
1 matrix3_value = RLPy.RMatrix3( 1, 2, 3,
2                                2, 3, 4,
3                                4, 2, 1 )
4 matrix3_Adjoint_transpose = matrix3_value.AdjointTranspose()
5 col0_Adjoint_transpose = matrix3_Adjoint_transpose.GetColumn(0)
6 
7 print(col0_Adjoint_transpose[0])
8 print(col0_Adjoint_transpose[1])
9 print(col0_Adjoint_transpose[2])

InverseTranspose( self )

Invert and transpose this 3x3 matrix.

Returns

A new inverted and transposed matrix - RMatrix3
1 matrix3_value = RLPy.RMatrix3( 1, 2, 3,
2                                2, 3, 4,
3                                4, 2, 1 )
4 matrix3_inverse_transpose = matrix3_value.InverseTranspose()
5 row0_inverse_transpose = matrix3_inverse_transpose.GetRow(0)
6 
7 print(row0_inverse_transpose[0])
8 print(row0_inverse_transpose[1])
9 print(row0_inverse_transpose[2])

Determinant( self )

Obtain the scalar value for this 3x3 matrix (|A|).

Returns

The determinant of the matrix - float
1 matrix3_value = RLPy.RMatrix3( 1, 2, 3,
2                                2, 3, 4,
3                                4, 2, 1 )
4 
5 print(matrix3_value.Determinant())

MaxColumn( self )

Find the maximum absolute value within this 3x3 matrix, and return the column in which the value is located. If all of the elements within the 3x3 matrix are 0 then return -1.

Returns

Index of column of M containing maximum abs entry, or -1 if M = 0 - int
1 matrix3_value = RLPy.RMatrix3( 10, 20, -30,
2                                 0,  0,   0,
3                                 0,  0,   0 )
4 
5 print(matrix3_value.MaxColumn()) # column:2 ->abs(-30)

MaxRow( self )

Find the maximum absolute value within this 3x3 matrix, and return the row in which the value is located. If all of the elements within the 3x3 matrix are 0 then return -1.

Returns

Index of row of M containing maximum abs entry, or -1 if M = 0 - int
1 matrix3_value = RLPy.RMatrix3( 10, 0, 0,
2                                20, 0, 0,
3                               -30, 0, 0 )
4 print(matrix3_value.MaxRow()) # Row:2 ->abs(-30)

OneNorm( self )

Return the sum of the column elements that contain the largest absolute values.

Returns

Norm of this 3x3 matrix - float
1 matrix3_row_value = RLPy.RMatrix3( 10, 0, 0,
2                                    20, 0, 0,
3                                   -30, 0, 0 )
4 print(matrix3_row_value.OneNorm()) # 10+20+abs(-30) = 60

InfNorm( self )

Return the sum of the row elements that contain the largest absolute values.

Returns

InfNorm of this 3x3 matrix - float
1 matrix3_column_value = RLPy.RMatrix3( 10, 20, -30,
2                                        0,  0,   0,
3                                        0,  0,   0 )
4 print(matrix3_column_value.InfNorm()) # 10+20+abs(-30) = 60

FromAxisAngle( self, rkAxis, fAngle )

Rotation matrix from axis angle。

Parameters

rkAxis [IN] axis vector - RVector3
fAngle [IN] angle in radians - float

Returns

A new matrix from specified axis angle - RMatrix3
 1 matrix3_orgin = RLPy.RMatrix3()
 2 matrix3_orgin.MakeIdentity()
 3 
 4 x_axis_vector = RLPy.RVector3( 1, 0, 0 )  # axis = "X"
 5 y_axis_vector = RLPy.RVector3( 0, 1, 0 )  # axis = "Y"
 6 z_axis_vector = RLPy.RVector3( 0, 0, 1 )  # axis = "Z"    
 7 
 8 matrix3_orgin.FromAxisAngle( x_axis_vector, 90 * RLPy.RMath.CONST_DEG_TO_RAD )
 9 matrix3_orgin.FromAxisAngle( y_axis_vector, 90 * RLPy.RMath.CONST_DEG_TO_RAD )
10 matrix3_orgin.FromAxisAngle( z_axis_vector, 90 * RLPy.RMath.CONST_DEG_TO_RAD )

RotationX( self, fAngle )

Rotate this 3x3 matrix around the x-axis.

Parameters

fAngle [IN] angle in radians - float

Returns

The rotated 3x3 matrix around the x-axis - RMatrix3
1 matrix3_orgin = RLPy.RMatrix3()
2 matrix3_orgin.MakeIdentity()
3 matrix3_orgin.RotationX( 90 * RLPy.RMath.CONST_DEG_TO_RAD )

RotationY( self, fAngle )

Rotate this 3x3 matrix around the y-axis。

Parameters

fAngle [IN] angle in radians - float

Returns

The rotated 3x3 matrix around the y-axis - RMatrix3
1 matrix3_orgin = RLPy.RMatrix3()
2 matrix3_orgin.MakeIdentity()
3 matrix3_orgin.RotationY( 90 * RLPy.RMath.CONST_DEG_TO_RAD )

RotationZ( self, fAngle )

Rotation this 3x3 matrix around the z-axis.

Parameters

fAngle [IN] angle in radians - float

Returns

A new 3x3 matrix of for rotations around z-axis - RMatrix3
1 matrix3_orgin = RLPy.RMatrix3()
2 matrix3_orgin.MakeIdentity()
3 matrix3_orgin.RotationZ( 90 * RLPy.RMath.CONST_DEG_TO_RAD )

AccuScale( self, rkScale )

Accumulate 3x3 matrix with scale vector.

Parameters

rkScale [IN] Scale vector - RVector3

Returns

A newly scaled matrix - RMatrix3
1 matrix3_orgin = RLPy.RMatrix3()
2 matrix3_orgin.MakeIdentity()
3 scale_vector = RLPy.RVector3( 2, 2, 2 )
4 matrix3_orgin.AccuScale(scale_vector)

ToEulerAngle( self, rkScaleself, Order, rx, ry, rz )

Convert 3x3 matrix to Euler angles.

Parameters

Order [IN] Euler order - RLPy.Rotation_Order
rx [OUT] Angle of x-axis in radians - float
ry [OUT] Angle of y-axis in radians - float
rz [OUT] Angle of z-axis in radians - float
 1 matrix3_value = RLPy.RMatrix3( -0, -0,  1,
 2                                 0, -1, -0,
 3                                 1,  0, -0 )
 4 euler_angle_x = 0
 5 euler_angle_y = 0
 6 euler_angle_z = 0
 7 result = matrix3_value.ToEulerAngle( RLPy.EEulerOrder_XYZ, euler_angle_x, euler_angle_y, euler_angle_z )
 8 
 9 print(result[0] * RLPy.RMath.CONST_RAD_TO_DEG) # 180
10 print(result[1] * RLPy.RMath.CONST_RAD_TO_DEG) # 90
11 print(result[2] * RLPy.RMath.CONST_RAD_TO_DEG) # 0

FromEulerAngle( self, Order, rx, ry, rz )

Convert Euler angle to a 3x3 matrix according to a rotation axis order.

Parameters

Order [IN] Euler order - RLPy.Rotation_Order
rx [IN] Angle of x-axis in radians - float
ry [IN] Angle of y-axis in radians - float
rz [IN] Angle of z-axis in radians - float

Returns

A new matrix from specified axis angle - RMatrix3
 1 matrix3_orgin = RLPy.RMatrix3()
 2 euler_angle_x = 90 * RLPy.RMath.CONST_DEG_TO_RAD
 3 euler_angle_y = 0
 4 euler_angle_z = 0
 5 matrix3_result = matrix3_orgin.FromEulerAngle( RLPy.EEulerOrder_XYZ, euler_angle_x, euler_angle_y, euler_angle_z)
 6 row0 = matrix3_result[0].GetRow(0)
 7 
 8 print(row0[0])
 9 print(row0[1])
10 print(row0[2])

FromSphereUnitVec( self, rkVec )

Convert Euler angle to matrix.

Parameters

rkVec [IN] vector - RVector3

Returns

A new 3x3 matrix from sphere unit vector - RMatrix3
1 vector = RLPy.RVector3( 0, 1, 0 )
2 matrix3_result =  RLPy.RMatrix3().FromSphereUnitVec( vector )
3 row0 = matrix3_result.GetRow(0)
4 
5 print(row0[0])
6 print(row0[1])
7 print(row0[2])

IsRightHandCoordinate( self )

Obtain this 3x3 matrix's coordinate system. True stands for right-handed coordinate system while False for left-handed.

Returns

True Right hand coordinate - bool
False Left hand coordinate - bool
1 matrix3_value = RLPy.RMatrix3( 1, 0, 0,
2                                0, 1, 0,
3                                0, 0, 1 )
4 result = matrix3_value.IsRightHandCoordinate()
5 
6 print(result)