IC8 Python API:RLPy RMatrix3

From Reallusion Wiki!
Jump to: navigation, search

Contents

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, *args)

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

Parameters

  • args

Member Functions

AccuScale (self, rkScale)

Accumulate 3x3 matrix with scale vector.

Parameters

  • rkScale

Adjoint (self)

Adjugate this 3x3 matrix.

Sample code

Calls `RLPy.RMatrix3.Adjoint` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 2, 3,
                                   2, 3, 4,
                                   4, 2, 1 )
    matrix3_Adjoint = matrix3_value.Adjoint()
    row0 = matrix3_Adjoint.GetRow(0)

    print(row0[0])
    print(row0[1])
    print(row0[2])

AdjointTranspose (self)

Adjugate and transpose this 3x3 matrix.

Sample code

Calls `RLPy.RMatrix3.AdjointTranspose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 2, 3,
                                   2, 3, 4,
                                   4, 2, 1 )
    matrix3_Adjoint_transpose = matrix3_value.AdjointTranspose()
    col0_Adjoint_transpose = matrix3_Adjoint_transpose.GetColumn(0)

    print(col0_Adjoint_transpose[0])
    print(col0_Adjoint_transpose[1])
    print(col0_Adjoint_transpose[2])

Determinant (self)

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

Sample code

Calls `RLPy.RMatrix3.Determinant` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 2, 3,
                                   2, 3, 4,
                                   4, 2, 1 )

    print(matrix3_value.Determinant())

DiagonalElements (self)

Returns the diagonal elements of this matrix.

E (self, *args)

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

Parameters

  • args

Sample code

Calls `RLPy.RMatrix3.E` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()

    print(matrix3.E(0)) #

FromAxisAngle (self, rkAxis, fAngle)

Rotation matrix from axis angle.

Parameters

  • rkAxis
  • fAngle

FromEulerAngle (Oreder, rx, ry, rz)

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

Parameters

  • Oreder
  • rx
  • ry
  • rz

FromSpereUnitVec (self, rkVec)

Creates a rotation matrix that aligns the z-axis with the supplied direction; a near-zero vector produces the identity matrix.

Parameters

  • rkVec

GetColumn (self, nCol)

Retreive a column inside a 3x3 matrix.

Parameters

  • nCol

Sample code

Calls `RLPy.RMatrix3.TimesTranspose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose_value = RLPy.RMatrix3( 3, 0, 0,
                                             0, 3, 0,
                                             0, 0, 3 )
    matrix3_times_transpose = matrix3_orgin.TimesTranspose(matrix3_transpose_value)
    row0 = matrix3_orgin.GetColumn(0)
    col0 = matrix3_times_transpose.GetColumn(0)

    print(row0[0]*3 == col0[0])
    print(row0[1]*3 == col0[1])
    print(row0[2]*3 == col0[2])

Sample code

Calls `RLPy.RMatrix3.GetColumn` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()
    col0 = matrix3.GetColumn(0)

    print(col0[0])
    print(col0[1])
    print(col0[2])

GetRow (self, nRow)

Retreive a row inside a 3x3 matrix.

Parameters

  • nRow

Sample code

Calls `RLPy.RMatrix3.Transpose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose = matrix3_orgin.Transpose()
    row0 = matrix3_orgin.GetRow(0)
    col0 = matrix3_transpose.GetColumn(0)

    print(row0[0] == col0[0])
    print(row0[1] == col0[1])
    print(row0[2] == col0[2])

Sample code

Calls `RLPy.RMatrix3.TransposeTimes` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose_value = RLPy.RMatrix3( 2, 0, 0,
                                             0, 2, 0,
                                             0, 0, 2 )
    matrix3_transpose_times = matrix3_orgin.TransposeTimes(matrix3_transpose_value)
    row0 = matrix3_orgin.GetRow(0)
    col0 = matrix3_transpose_times.GetColumn(0)

    print(row0[0]*2 == col0[0])
    print(row0[1]*2 == col0[1])
    print(row0[2]*2 == col0[2])

Sample code

Calls `RLPy.RMatrix3.GetRow` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()
    row0 = matrix3.GetRow(0)

    print(row0[0])
    print(row0[1])
    print(row0[2])

InfNorm (self)

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

Sample code

Calls `RLPy.RMatrix3.InfNorm` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_column_value = RLPy.RMatrix3( 10, 20, -30,
                                           0,  0,   0,
                                           0,  0,   0 )
    print(matrix3_column_value.InfNorm()) # 10+20+abs(-30) = 60

Inverse (self)

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

Sample code

Calls `RLPy.RMatrix3.Inverse` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 2, 3,
                                   2, 3, 4,
                                   4, 2, 1 )
    matrix3_inverse = matrix3_value.Inverse()
    row0 = matrix3_inverse.GetRow(0)

    print(row0[0])
    print(row0[1])
    print(row0[2])

InverseTranspose (self)

Invert and transpose this 3x3 matrix.

Sample code

Calls `RLPy.RMatrix3.InverseTranspose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 2, 3,
                                   2, 3, 4,
                                   4, 2, 1 )
    matrix3_inverse_transpose = matrix3_value.InverseTranspose()
    row0_inverse_transpose = matrix3_inverse_transpose.GetRow(0)

    print(row0_inverse_transpose[0])
    print(row0_inverse_transpose[1])
    print(row0_inverse_transpose[2])

IsRightHandCoordinate (self)

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

Sample code

Calls `RLPy.RMatrix3.IsRightHandCoordinate` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 1, 0, 0,
                                   0, 1, 0,
                                   0, 0, 1 )
    result = matrix3_value.IsRightHandCoordinate()

    print(result)

M (self, *args)

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

Parameters

  • args

Sample code

Calls `RLPy.RMatrix3.M` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()

    print(matrix3.M(0,0))  # <Swig Object of type 'float *' at 0x0000020316B015A0>

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]

Sample code

Calls `RLPy.RMatrix3.M` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()

    print(matrix3.M(0,0))  # <Swig Object of type 'float *' at 0x0000020316B015A0>

Sample code

Calls `RLPy.RMatrix3.GetRow` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()
    row0 = matrix3.GetRow(0)

    print(row0[0])
    print(row0[1])
    print(row0[2])

Sample code

Calls `RLPy.RMatrix3.MakeIdentity` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()

Sample code

Calls `RLPy.RMatrix3.E` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()

    print(matrix3.E(0)) #

Sample code

Calls `RLPy.RMatrix3.GetColumn` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3 = RLPy.RMatrix3()
    matrix3.MakeIdentity()
    col0 = matrix3.GetColumn(0)

    print(col0[0])
    print(col0[1])
    print(col0[2])

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.

Sample code

Calls `RLPy.RMatrix3.MaxColumn` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 10, 20, -30,
                                    0,  0,   0,
                                    0,  0,   0 )

    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.

Sample code

Calls `RLPy.RMatrix3.MaxRow` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_value = RLPy.RMatrix3( 10, 0, 0,
                                   20, 0, 0,
                                  -30, 0, 0 )
    print(matrix3_value.MaxRow()) # Row:2 ->abs(-30)

OneNorm (self)

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

Sample code

Calls `RLPy.RMatrix3.OneNorm` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_row_value = RLPy.RMatrix3( 10, 0, 0,
                                       20, 0, 0,
                                      -30, 0, 0 )
    print(matrix3_row_value.OneNorm()) # 10+20+abs(-30) = 60

RotationX (self, fAngle)

Rotate this 3x3 matrix around the x-axis.

Parameters

  • fAngle

RotationY (self, fAngle)

Rotate this 3x3 matrix around the y-axis.

Parameters

  • fAngle

RotationZ (self, fAngle)

Rotation this 3x3 matrix around the z-axis.

Parameters

  • fAngle

TimesTranspose (self, mM)

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

Parameters

  • mM

Sample code

Calls `RLPy.RMatrix3.TimesTranspose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose_value = RLPy.RMatrix3( 3, 0, 0,
                                             0, 3, 0,
                                             0, 0, 3 )
    matrix3_times_transpose = matrix3_orgin.TimesTranspose(matrix3_transpose_value)
    row0 = matrix3_orgin.GetColumn(0)
    col0 = matrix3_times_transpose.GetColumn(0)

    print(row0[0]*3 == col0[0])
    print(row0[1]*3 == col0[1])
    print(row0[2]*3 == col0[2])

ToEulerAngle (self, *args)

Convert 3x3 matrix to Euler angles.

Parameters

  • args

Transpose (self)

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

Sample code

Calls `RLPy.RMatrix3.Transpose` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose = matrix3_orgin.Transpose()
    row0 = matrix3_orgin.GetRow(0)
    col0 = matrix3_transpose.GetColumn(0)

    print(row0[0] == col0[0])
    print(row0[1] == col0[1])
    print(row0[2] == col0[2])

TransposeTimes (self, mM)

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

Parameters

  • mM

Sample code

Calls `RLPy.RMatrix3.TransposeTimes` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_orgin = RLPy.RMatrix3( 1, 2, 3,
                                   4, 5, 6,
                                   7, 8, 9 )
    matrix3_transpose_value = RLPy.RMatrix3( 2, 0, 0,
                                             0, 2, 0,
                                             0, 0, 2 )
    matrix3_transpose_times = matrix3_orgin.TransposeTimes(matrix3_transpose_value)
    row0 = matrix3_orgin.GetRow(0)
    col0 = matrix3_transpose_times.GetColumn(0)

    print(row0[0]*2 == col0[0])
    print(row0[1]*2 == col0[1])
    print(row0[2]*2 == col0[2])

__add__ (self, mM)

The "addition" operator. See Also: +=

Parameters

  • mM

Sample code

Calls `RLPy.RMatrix3.__add__` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_a = RLPy.RMatrix3( 1, 2, 3,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_b = RLPy.RMatrix3( 2, 2, 2,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_result = matrix3_a + matrix3_b

    print( matrix3_result.GetRow(0)[0] == 1+2 ) # true
    print( matrix3_result.GetRow(0)[1] == 2+2 ) # true
    print( matrix3_result.GetRow(0)[2] == 3+2 ) # true

__eq__ (self, mM)

The "equal to" operator. Performs a one-by-one comparison of the matrix array. See Also: !=

Parameters

  • mM

__ge__ (self, mM)

Reports whether this value is greater than or equal to another value.

Parameters

  • mM

__gt__ (self, mM)

Reports whether this value is greater than another value.

Parameters

  • mM

__iadd__ (self, mM)

Adds another value to this value in place.

Parameters

  • mM

__imul__ (self, *args)

Multiplies this value by another value in place.

Parameters

  • args

__isub__ (self, mM)

Subtracts another value from this value in place.

Parameters

  • mM

__itruediv__ (self, *args)

Divides this value by another value in place.

Parameters

  • args

__le__ (self, mM)

Reports whether this value is less than or equal to another value.

Parameters

  • mM

__lt__ (self, mM)

Reports whether this value is less than another value.

Parameters

  • mM

__mul__ (self, *args)

The "multiplication" operator. See Also: *=

Parameters

  • args

Sample code

Calls `RLPy.RMatrix3.__mul__` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_a = RLPy.RMatrix3( 1, 2, 3,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_b = RLPy.RMatrix3( 2, 0, 0,
                               2, 0, 0,
                               2, 0, 0 )
    matrix3_result = matrix3_a * matrix3_b
    print( matrix3_result.GetRow(0)[0] == 1*2 + 2*2 + 3*2 ) # true

__ne__ (self, mM)

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

Parameters

  • mM

__neg__ (self)

Returns the negated value.

__sub__ (self, mM)

The "subtraction" operator. See Also: -=

Parameters

  • mM

Sample code

Calls `RLPy.RMatrix3.__sub__` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_a = RLPy.RMatrix3( 1, 2, 3,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_b = RLPy.RMatrix3( 2, 2, 2,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_result = matrix3_a - matrix3_b

    print( matrix3_result.GetRow(0)[0] == 1-2 ) # true
    print( matrix3_result.GetRow(0)[1] == 2-2 ) # true
    print( matrix3_result.GetRow(0)[2] == 3-2 ) # true

__truediv__ (self, *args)

The "division" operator. See Also: /=

Parameters

  • args

Sample code

Calls `RLPy.RMatrix3.__truediv__` with the inputs shown in the example.

def run_script():
    import RLPy
    matrix3_a = RLPy.RMatrix3( 1, 2, 3,
                               0, 0, 0,
                               0, 0, 0 )
    matrix3_result = matrix3_a / 2

    print( matrix3_result.GetRow(0)[0] == 1/2 ) # true
    print( matrix3_result.GetRow(0)[1] == 2/2 ) # true
    print( matrix3_result.GetRow(0)[2] == 3/2 ) # true

Properties

thisown

Indicates whether this SWIG proxy owns the underlying C++ object.

Constants

COUNT

DIMENSION

IDENTITY (*args)

Parameters

  • args

ZERO (*args)

Parameters

  • args