Uranium
Application Framework
 All Classes Namespaces Files Functions Variables Pages
UM.Math.Matrix.Matrix Class Reference

This class is a 4x4 homogeneous matrix wrapper around numpy. More...

Public Member Functions

def __init__
 
def __eq__
 
def at
 
def setRow
 
def setColumn
 
def multiply
 
def preMultiply
 
def getData
 Get raw data. More...
 
def setToIdentity
 Create a 4x4 identity matrix. More...
 
def invert
 Invert the matrix.
 
def getInverse
 Return a inverted copy of the matrix. More...
 
def getTransposed
 Return the transpose of the matrix. More...
 
def translate
 Translate the matrix based on Vector. More...
 
def setByTranslation
 Set the matrix by translation vector. More...
 
def setTranslation
 
def getTranslation
 
def rotateByAxis
 Rotate the matrix based on rotation axis. More...
 
def setByRotationAxis
 Set the matrix based on rotation axis. More...
 
def compose
 Return transformation matrix from sequence of transformations. More...
 
def getEuler
 Return Euler angles from rotation matrix for specified axis sequence. More...
 
def setByEuler
 Return homogeneous rotation matrix from Euler angles and axis sequence. More...
 
def scaleByFactor
 Scale the matrix by factor wrt origin & direction. More...
 
def setByScaleFactor
 Set the matrix by scale by factor wrt origin & direction. More...
 
def setByScaleVector
 
def getScale
 
def setOrtho
 Set the matrix to an orthographic projection. More...
 
def setPerspective
 Set the matrix to a perspective projection. More...
 
def decompose
 Return sequence of transformations from transformation matrix. More...
 
def __repr__
 

Static Public Member Functions

def fromPositionOrientationScale
 

Detailed Description

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.

Member Function Documentation

def UM.Math.Matrix.Matrix.compose (   self,
  scale 
)

Return transformation matrix from sequence of transformations.

This is the inverse of the decompose_matrix function.

Parameters
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
mirrorvector with mirror factors (1 if that axis is not mirrored, -1 if it is)
def UM.Math.Matrix.Matrix.decompose (   self,
  Tuple,
  Vector,
  Vector,
  Vector,
  Vector,
  Vector 
)

Return sequence of transformations from transformation matrix.

Returns
Tuple containing scale (vector), shear (vector), angles (vector), translation (vector) and mirror (vector) It will raise a ValueError if matrix is of wrong type or degenerative.
def UM.Math.Matrix.Matrix.getData (   self,
  numpy,
  ndarray 
)

Get raw data.

Returns
4x4 numpy array
def UM.Math.Matrix.Matrix.getEuler (   self,
  axes 
)

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.

def UM.Math.Matrix.Matrix.getInverse (   self,
  Matrix 
)

Return a inverted copy of the matrix.

Returns
The invertex matrix.
def UM.Math.Matrix.Matrix.getTransposed (   self,
  Matrix 
)

Return the transpose of the matrix.

def UM.Math.Matrix.Matrix.rotateByAxis (   self,
  angle 
)

Rotate the matrix based on rotation axis.

Parameters
angleThe angle by which matrix needs to be rotated.
directionAxis by which the matrix needs to be rotated about.
pointPoint where from where the rotation happens. If None, origin is used.
def UM.Math.Matrix.Matrix.scaleByFactor (   self,
  factor 
)

Scale the matrix by factor wrt origin & direction.

Parameters
factorThe factor by which to scale
originFrom where does the scaling need to be done
directionIn what direction is the scaling (if None, it's uniform)
def UM.Math.Matrix.Matrix.setByEuler (   self,
  ai 
)

Return homogeneous rotation matrix from Euler angles and axis sequence.

Parameters
aiEulers roll
ajEulers pitch
akEulers yaw
axesOne of 24 axis sequences as string or encoded tuple
def UM.Math.Matrix.Matrix.setByRotationAxis (   self,
  angle 
)

Set the matrix based on rotation axis.

This overwrites any existing data.

Parameters
angleThe angle by which matrix needs to be rotated in radians.
directionAxis by which the matrix needs to be rotated about.
pointPoint where from where the rotation happens. If None, origin is used.
def UM.Math.Matrix.Matrix.setByScaleFactor (   self,
  factor 
)

Set the matrix by scale by factor wrt origin & direction.

This overwrites any existing data

Parameters
factorThe factor by which to scale
originFrom where does the scaling need to be done
directionIn what direction is the scaling (if None, it's uniform)
def UM.Math.Matrix.Matrix.setByTranslation (   self,
  direction 
)

Set the matrix by translation vector.

This overwrites any existing data.

Parameters
directionThe vector by which the (unit) matrix needs to be translated.
def UM.Math.Matrix.Matrix.setOrtho (   self,
  left 
)

Set the matrix to an orthographic projection.

This overwrites any existing data.

Parameters
leftThe left edge of the projection
rightThe right edge of the projection
topThe top edge of the projection
bottomThe bottom edge of the projection
nearThe near plane of the projection
farThe far plane of the projection
def UM.Math.Matrix.Matrix.setPerspective (   self,
  fovy 
)

Set the matrix to a perspective projection.

This overwrites any existing data.

Parameters
fovyField of view in the Y direction
aspectThe aspect ratio
nearDistance to the near plane
farDistance to the far plane
def UM.Math.Matrix.Matrix.setToIdentity (   self,
  None 
)

Create a 4x4 identity matrix.

This overwrites any existing data.

def UM.Math.Matrix.Matrix.translate (   self,
  direction 
)

Translate the matrix based on Vector.

Parameters
directionThe vector by which the matrix needs to be translated.

The documentation for this class was generated from the following file: