Skip to Content

Matrix

Quick Facts

PropertyValue
ClassCENPyOlpMatrix
Modulecenpylib.CENPyOlpMatrix
Packagecenpylib
ReleaseR2025.2.4
Methods17

Quick Start

# Boilerplate Example matrix = ... # obtained from the runtime context result = matrix.GetPosition()

Method Index

MethodReturnsSummary
TranslateTranslate the matrix.
RotateXRotate the matrix around x axis.
RotateYRotate the matrix around y axis.
RotateZRotate the matrix around z axis.
RotateRotate the matrix around given axis.
GetPositionCENPyOlpPointGet position of matrix as a point.
GetXDirectionCENPyOlpVectorGet the matrix x direction as vector.
GetYDirectionCENPyOlpVectorGet the matrix y direction as vector.
GetZDirectionCENPyOlpVectorGet the matrix z direction as vector.
TransformCENPyOlpPointTransform a point within this matrix.
GetRotationtupleGet rotation angles of this matrix.
InverseCENPyOlpMatrixInvert the matrix.
MultiplyCENPyOlpMatrixMultiply two matrices.
SetRotationSets the rotational part of the matrix as determined by the two input vectors.
SetRotationSets the rotational part of the matrix as determined by three input vectors.
GetDistancefloatGets the distance between the current matrix and the given matrix.
IsValidboolChecks if the matrix is valid.

Query Methods

GetPosition

def GetPosition() -> CENPyOlpPoint

Get position of matrix as a point.

Returns: CENPyOlpPoint — position as point

GetXDirection

def GetXDirection() -> CENPyOlpVector

Get the matrix x direction as vector.

Returns: CENPyOlpVector — direction as vector

GetYDirection

def GetYDirection() -> CENPyOlpVector

Get the matrix y direction as vector.

Returns: CENPyOlpVector — direction as vector

GetZDirection

def GetZDirection() -> CENPyOlpVector

Get the matrix z direction as vector.

Returns: CENPyOlpVector — direction as vector

GetRotation

def GetRotation(inDegrees: bool=False) -> tuple

Get rotation angles of this matrix.

Parameters:

NameTypeDescription
inDegreesboolflag 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) -> float

Gets the distance between the current matrix and the given matrix.

Parameters:

NameTypeDescription
otherMatrixCENPyOlpMatrixAnother matrix.

Returns: float — The distance.

IsValid

def IsValid() -> bool

Checks 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:

NameTypeDescription
firstAxisCENPyOlpVectorfirst axis
secondAxisCENPyOlpVectorsecond axis
axesPairintpair 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:

NameTypeDescription
xAxisCENPyOlpVectorthe vector for the X axis.
yAxisCENPyOlpVectorthe vector for the Y axis.
zAxisCENPyOlpVectorthe vector for the Z axis.

Execution & Actions

Transform

def Transform(pyPointToTransform: CENPyOlpPoint) -> CENPyOlpPoint

Transform a point within this matrix.

Parameters:

NameTypeDescription
pyPointToTransformCENPyOlpPointpoint to transform

Returns: CENPyOlpPoint — the transformed point

Utilities

Translate

def Translate(x: float, y: float, z: float, withinLocalSystem: bool=True)

Translate the matrix.

Parameters:

NameTypeDescription
xfloatthe x value
yfloatthe y value
zfloatthe z value
withinLocalSystemboolthe referring to local system (default = True), False for global (default: True)

RotateX

def RotateX(angle: float)

Rotate the matrix around x axis.

Parameters:

NameTypeDescription
anglefloatrotation angle

RotateY

def RotateY(angle: float)

Rotate the matrix around y axis.

Parameters:

NameTypeDescription
anglefloatrotation angle

RotateZ

def RotateZ(angle: float)

Rotate the matrix around z axis.

Parameters:

NameTypeDescription
anglefloatrotation angle

Rotate

def Rotate(angle: float, axis: CENPyOlpVector)

Rotate the matrix around given axis.

Parameters:

NameTypeDescription
anglefloatrotation angle
axisCENPyOlpVectorrotation axis

Inverse

def Inverse() -> CENPyOlpMatrix

Invert the matrix.

Returns: CENPyOlpMatrix — the inverted matrix

Multiply

def Multiply(pyLeftMatrix: CENPyOlpMatrix, pyRightMatrix: CENPyOlpMatrix) -> CENPyOlpMatrix

Multiply two matrices.

Parameters:

NameTypeDescription
pyLeftMatrixCENPyOlpMatrixinput of left matrix
pyRightMatrixCENPyOlpMatrixinput of right matrix

Returns: CENPyOlpMatrix — result matrix

Version Notes

This class is documented as of release R2025.2.4.

Was this page helpful?