Matrix2D
Canonical path: NemAll_Python_Geometry.Matrix2D
Representation class for 2D matrix
Matrix data organization in memory: [0..8] indexes of array values 0,1, 3,4 - rotation, scaling and shrinking 6,7 - translation
0, 1, 2, 3, 4, 5, 6, 7, 8
All operations are correct only in geometry calculation context and can not be used for calculating with regular 4x4 matrix.
Methods:
-
AddDimension–Create a 3D matrix from this 2D matrix
-
Determinant–Calculate determinant
-
IsIdentity–Check to identity matrix
-
Multiply–Multiple matrix with given matrix
-
Reflection–Reflection across a axis of given angle
-
Reverse–Reverse matrix
-
Rotation–Rotate the matrix
-
Scaling–Scale the matrix
-
SetIdentity–Initialize identity matrix
-
SetReflection–Initialize matrix only with reflection
-
SetRotation–Initialize matrix only with rotation
-
SetScaling–Initialize matrix only with scaling factors
-
SetTranslation–Initialize matrix only with translation
-
SetValue–Set the matrix element at a specified position
-
Translate–Translate the matrix
-
__add__–Matrix addition
-
__getitem__–Get the matrix element at a specified position
-
__iadd__–Matrix addition
-
__imul__–Matrix multiplication
-
__init__–Overloaded function. See individual overloads.
-
__isub__–Matrix addition
-
__mul__–Matrix multiplication
-
__repr__–Convert to string
-
__sub__–Matrix addition
AddDimension
AddDimension() -> Matrix3D
IsIdentity
Check to identity matrix
Returns:
-
bool–Return true when is matrix identity, otherwise false.
Multiply
Reflection
Reflection(axis: Axis2D)
Reverse
Reverse matrix
This method provide geometrical inverse matrix and can not be used with regular inverse 4x4 matrix calculations.
Geometrical representation: Point3D = { Point3D * Matrix } * Matrix.Reverse()
Returns:
-
bool–True when operation is successful, otherwise false.
Rotation
Scaling
Scale the matrix
Parameters:
-
scaleX(float) –Scale in X axis.
-
scaleY(float) –Scale in Y axis.
SetReflection
SetReflection(axis: Axis2D)
SetRotation
SetScaling
Initialize matrix only with scaling factors
Parameters:
-
scaleX(float) –Scale in X axis.
-
scaleY(float) –Scale in Y axis.
SetTranslation
SetTranslation(vec: Vector2D)
SetValue
Set the matrix element at a specified position
Use this method when you don't want to catch exception by operator[].
Parameters:
-
index(int) –Position index <0..9>
-
value(float) –Value for set
Returns:
-
bool–True when operation successful (index is not out of range), otherwise false.
Translate
Translate(vec: Vector2D)
__add__
__getitem__
Get the matrix element at a specified position
This method is checked and throwing Geometry::Exception when index is out of range.
Parameters:
-
index(int) –Position index <0..9>
Returns:
-
float–Returns an element at a specified position.