Uranium
Application Framework
|
This class is a 4x4 homogeneous matrix wrapper around numpy. More...
Public Member Functions | |
def | LOG_NUMPY (self, str_matrix_name, matrix) |
def | LOG_MATRIX (self, str_matrix_name, matrix) |
def | __init__ (self, data=None) |
def | __eq__ (self, other) |
def | at (self, int x, int y) |
def | setRow (self, int index, value) |
def | setColumn (self, int index, value) |
def | multiply (self, Union[Vector, "Matrix"] other, bool copy=False) |
def | preMultiply (self, Union[Vector, "Matrix"] other, bool copy=False) |
def | getData (self) |
Get raw data. More... | |
def | setToIdentity (self) |
Create a 4x4 identity matrix. More... | |
def | invert (self) |
Invert the matrix. | |
"Matrix" | getInverse (self) |
Return a inverted copy of the matrix. More... | |
"Matrix" | getTransposed (self) |
Return the transpose of the matrix. | |
def | translate (self, Vector direction) |
Translate the matrix based on Vector. More... | |
def | setByTranslation (self, Vector direction) |
Set the matrix by translation vector. More... | |
def | setTranslation (self, translation) |
Vector | getTranslation (self) |
def | rotateByAxis (self, angle, Vector direction, Optional[Vector] point=None) |
Rotate the matrix based on rotation axis. More... | |
def | setByRotationAxis (self, angle, Vector direction, Optional[Vector] point=None) |
Set the matrix based on rotation axis. More... | |
def | compose (self, Vector scale=None, Vector shear=None, Vector angles=None, Vector translate=None, perspective=None, Vector mirror=None) |
Return transformation matrix from sequence of transformations. More... | |
def | getEuler (self, axes="sxyz") |
Return Euler angles from rotation matrix for specified axis sequence. More... | |
def | setByEuler (self, ai, aj, ak, axes="sxyz") |
Return homogeneous rotation matrix from Euler angles and axis sequence. More... | |
def | scaleByFactor (self, factor, Optional[Vector] origin=None, Optional[Vector] direction=None) |
Scale the matrix by factor wrt origin & direction. More... | |
def | setByScaleFactor (self, factor, Optional[Vector] origin=None, Optional[Vector] direction=None) |
Set the matrix by scale by factor wrt origin & direction. More... | |
def | setByScaleVector (self, Vector scale) |
Vector | getScale (self) |
def | setOrtho (self, left, right, bottom, top, near, far) |
Set the matrix to an orthographic projection. More... | |
def | setPerspective (self, fovy, aspect, near, far) |
Set the matrix to a perspective projection. More... | |
def | decompose (self) |
Return sequence of transformations from transformation matrix. More... | |
def | __repr__ (self) |
Static Public Member Functions | |
"Matrix" | fromPositionOrientationScale (Vector position, "Quaternion" orientation, Vector scale) |
This class is a 4x4 homogeneous matrix wrapper around numpy.
Heavily based (in most cases a straight copy with some refactoring) on the excellent 'library' Transformations.py created by Christoph Gohlke.
def UM.Math.Matrix.Matrix.compose | ( | self, | |
Vector | scale = None , |
||
Vector | shear = None , |
||
Vector | angles = None , |
||
Vector | translate = None , |
||
perspective = None , |
|||
Vector | mirror = None |
||
) |
Return transformation matrix from sequence of transformations.
This is the inverse of the decompose_matrix function.
scale | : vector of 3 scaling factors |
shear | : list of shear factors for x-y, x-z, y-z axes |
angles | : list of Euler angles about static x, y, z axes |
translate | : translation vector along x, y, z axes |
perspective | : perspective partition of matrix |
mirror | vector with mirror factors (1 if that axis is not mirrored, -1 if it is) |
def UM.Math.Matrix.Matrix.decompose | ( | self | ) |
Return sequence of transformations from transformation matrix.
def UM.Math.Matrix.Matrix.getData | ( | self | ) |
Get raw data.
def UM.Math.Matrix.Matrix.getEuler | ( | self, | |
axes = "sxyz" |
|||
) |
Return Euler angles from rotation matrix for specified axis sequence.
axes : One of 24 axis sequences as string or encoded tuple Note that many Euler angle triplets can describe one matrix.
"Matrix" UM.Math.Matrix.Matrix.getInverse | ( | self | ) |
Return a inverted copy of the matrix.
def UM.Math.Matrix.Matrix.rotateByAxis | ( | self, | |
angle, | |||
Vector | direction, | ||
Optional[Vector] | point = None |
||
) |
Rotate the matrix based on rotation axis.
angle | The angle by which matrix needs to be rotated. |
direction | Axis by which the matrix needs to be rotated about. |
point | Point where from where the rotation happens. If None, origin is used. |
def UM.Math.Matrix.Matrix.scaleByFactor | ( | self, | |
factor, | |||
Optional[Vector] | origin = None , |
||
Optional[Vector] | direction = None |
||
) |
Scale the matrix by factor wrt origin & direction.
factor | The factor by which to scale |
origin | From where does the scaling need to be done |
direction | In what direction is the scaling (if None, it's uniform) |
def UM.Math.Matrix.Matrix.setByEuler | ( | self, | |
ai, | |||
aj, | |||
ak, | |||
axes = "sxyz" |
|||
) |
Return homogeneous rotation matrix from Euler angles and axis sequence.
ai | Eulers roll |
aj | Eulers pitch |
ak | Eulers yaw |
axes | One of 24 axis sequences as string or encoded tuple |
def UM.Math.Matrix.Matrix.setByRotationAxis | ( | self, | |
angle, | |||
Vector | direction, | ||
Optional[Vector] | point = None |
||
) |
Set the matrix based on rotation axis.
This overwrites any existing data.
angle | The angle by which matrix needs to be rotated in radians. |
direction | Axis by which the matrix needs to be rotated about. |
point | Point where from where the rotation happens. If None, origin is used. |
def UM.Math.Matrix.Matrix.setByScaleFactor | ( | self, | |
factor, | |||
Optional[Vector] | origin = None , |
||
Optional[Vector] | direction = None |
||
) |
Set the matrix by scale by factor wrt origin & direction.
This overwrites any existing data
factor | The factor by which to scale |
origin | From where does the scaling need to be done |
direction | In what direction is the scaling (if None, it's uniform) |
def UM.Math.Matrix.Matrix.setByTranslation | ( | self, | |
Vector | direction | ||
) |
Set the matrix by translation vector.
This overwrites any existing data.
direction | The vector by which the (unit) matrix needs to be translated. |
def UM.Math.Matrix.Matrix.setOrtho | ( | self, | |
left, | |||
right, | |||
bottom, | |||
top, | |||
near, | |||
far | |||
) |
Set the matrix to an orthographic projection.
This overwrites any existing data.
left | The left edge of the projection |
right | The right edge of the projection |
top | The top edge of the projection |
bottom | The bottom edge of the projection |
near | The near plane of the projection |
far | The far plane of the projection |
def UM.Math.Matrix.Matrix.setPerspective | ( | self, | |
fovy, | |||
aspect, | |||
near, | |||
far | |||
) |
Set the matrix to a perspective projection.
This overwrites any existing data.
fovy | Field of view in the Y direction |
aspect | The aspect ratio |
near | Distance to the near plane |
far | Distance to the far plane |
def UM.Math.Matrix.Matrix.setToIdentity | ( | self | ) |
Create a 4x4 identity matrix.
This overwrites any existing data.
def UM.Math.Matrix.Matrix.translate | ( | self, | |
Vector | direction | ||
) |
Translate the matrix based on Vector.
direction | The vector by which the matrix needs to be translated. |