Matrix
Quick Facts
| Property | Value |
|---|---|
| Class | CENPyOlpMatrix |
| Module | cenpylib.CENPyOlpMatrix |
| Package | cenpylib |
| Release | R2025.2.4 |
| Methods | 17 |
Quick Start
# Boilerplate Example
matrix = ... # obtained from the runtime context
result = matrix.GetPosition()Method Index
| Method | Returns | Summary |
|---|---|---|
Translate | — | Translate the matrix. |
RotateX | — | Rotate the matrix around x axis. |
RotateY | — | Rotate the matrix around y axis. |
RotateZ | — | Rotate the matrix around z axis. |
Rotate | — | Rotate the matrix around given axis. |
GetPosition | CENPyOlpPoint | Get position of matrix as a point. |
GetXDirection | CENPyOlpVector | Get the matrix x direction as vector. |
GetYDirection | CENPyOlpVector | Get the matrix y direction as vector. |
GetZDirection | CENPyOlpVector | Get the matrix z direction as vector. |
Transform | CENPyOlpPoint | Transform a point within this matrix. |
GetRotation | tuple | Get rotation angles of this matrix. |
Inverse | CENPyOlpMatrix | Invert the matrix. |
Multiply | CENPyOlpMatrix | Multiply two matrices. |
SetRotation | — | Sets the rotational part of the matrix as determined by the two input vectors. |
SetRotation | — | Sets the rotational part of the matrix as determined by three input vectors. |
GetDistance | float | Gets the distance between the current matrix and the given matrix. |
IsValid | bool | Checks if the matrix is valid. |
Query Methods
GetPosition
def GetPosition() -> CENPyOlpPointGet position of matrix as a point.
Returns: CENPyOlpPoint — position as point
GetXDirection
def GetXDirection() -> CENPyOlpVectorGet the matrix x direction as vector.
Returns: CENPyOlpVector — direction as vector
GetYDirection
def GetYDirection() -> CENPyOlpVectorGet the matrix y direction as vector.
Returns: CENPyOlpVector — direction as vector
GetZDirection
def GetZDirection() -> CENPyOlpVectorGet the matrix z direction as vector.
Returns: CENPyOlpVector — direction as vector
GetRotation
def GetRotation(inDegrees: bool=False) -> tupleGet rotation angles of this matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
inDegrees | bool | flag specifying the unit: True = degree, False = radians (default: False) |
Returns: tuple — output of x angle, output of y angle, output of z angle
GetDistance
def GetDistance(otherMatrix: CENPyOlpMatrix) -> floatGets the distance between the current matrix and the given matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
otherMatrix | CENPyOlpMatrix | Another matrix. |
Returns: float — The distance.
IsValid
def IsValid() -> boolChecks if the matrix is valid.
Returns: bool — True if the matrix is not None, otherwise False.
Mutation Methods
SetRotation
def SetRotation(firstAxis: CENPyOlpVector, secondAxis: CENPyOlpVector, axesPair: int)Sets the rotational part of the matrix as determined by the two input vectors. ///The input vectors are assumed to be orthogonal and normalized.
Parameters:
| Name | Type | Description |
|---|---|---|
firstAxis | CENPyOlpVector | first axis |
secondAxis | CENPyOlpVector | second axis |
axesPair | int | pair of rotation axis |
SetRotation
def SetRotation(xAxis: CENPyOlpVector, yAxis: CENPyOlpVector, zAxis: CENPyOlpVector)Sets the rotational part of the matrix as determined by three input vectors. The input vectors are assumed to be orthogonal normalized.
Parameters:
| Name | Type | Description |
|---|---|---|
xAxis | CENPyOlpVector | the vector for the X axis. |
yAxis | CENPyOlpVector | the vector for the Y axis. |
zAxis | CENPyOlpVector | the vector for the Z axis. |
Execution & Actions
Transform
def Transform(pyPointToTransform: CENPyOlpPoint) -> CENPyOlpPointTransform a point within this matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
pyPointToTransform | CENPyOlpPoint | point to transform |
Returns: CENPyOlpPoint — the transformed point
Utilities
Translate
def Translate(x: float, y: float, z: float, withinLocalSystem: bool=True)Translate the matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
x | float | the x value |
y | float | the y value |
z | float | the z value |
withinLocalSystem | bool | the referring to local system (default = True), False for global (default: True) |
RotateX
def RotateX(angle: float)Rotate the matrix around x axis.
Parameters:
| Name | Type | Description |
|---|---|---|
angle | float | rotation angle |
RotateY
def RotateY(angle: float)Rotate the matrix around y axis.
Parameters:
| Name | Type | Description |
|---|---|---|
angle | float | rotation angle |
RotateZ
def RotateZ(angle: float)Rotate the matrix around z axis.
Parameters:
| Name | Type | Description |
|---|---|---|
angle | float | rotation angle |
Rotate
def Rotate(angle: float, axis: CENPyOlpVector)Rotate the matrix around given axis.
Parameters:
| Name | Type | Description |
|---|---|---|
angle | float | rotation angle |
axis | CENPyOlpVector | rotation axis |
Inverse
def Inverse() -> CENPyOlpMatrixInvert the matrix.
Returns: CENPyOlpMatrix — the inverted matrix
Multiply
def Multiply(pyLeftMatrix: CENPyOlpMatrix, pyRightMatrix: CENPyOlpMatrix) -> CENPyOlpMatrixMultiply two matrices.
Parameters:
| Name | Type | Description |
|---|---|---|
pyLeftMatrix | CENPyOlpMatrix | input of left matrix |
pyRightMatrix | CENPyOlpMatrix | input of right matrix |
Returns: CENPyOlpMatrix — result matrix
Related Types
Version Notes
This class is documented as of release R2025.2.4.