Matrix3D
Canonical path: NemAll_Python_Geometry.Matrix3D
Representation class for 3D matrix
Matrix data organization in memory: [0..15] indexes of array values 0,1,2, 4,5,6, 8,9,10 - rotation, scaling and shrinking 12,13,14 - translatio
0, 1, 2, 3
4, 5, 6, 7
8, 9, 10,11
12,13,14,15
All operations are correct only in geometry calculation context and can not be used for calculating with regular 4x4 matrix.
GaussInvert
Inverse matrix by Gauss
Returns:
-
bool
–True when operation is successful, otherwise false.
GetScaling
GetScaling() -> tuple[float, float, float]
Calculates the scaling factors from the matrix
Returns:
-
tuple[float, float, float]
–tuple(Scale in X axis, Scale in Y axis, Scale in Z axis)
GetTranslationVector
GetTranslationVector() -> Vector3D
IsIdentity
Check to identity matrix
Returns:
-
bool
–Return true when is matrix identity, otherwise false.
Multiply
ReduceZDimension
ReduceZDimension() -> Matrix2D
Reflection
Reflection(plane: Plane3D)
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
Scale current matrix, not created new one.
Parameters:
-
scaleX
(float
) –Scale in X axis.
-
scaleY
(float
) –Scale in Y axis.
-
scaleZ
(float
) –Scale in Z axis.
SetProjection
SetProjection(proj: eProjectionMatrixType)
Create a matrix for the required projection
Method throw THROW_GEO_EXCEPTION_INCORRECT_PARAMETERS_ geometry exception in case of invalid proj.
Parameters:
-
proj
(eProjectionMatrixType
) –The required projection
SetReflection
SetReflection(plane: Plane3D)
SetRotation
overloaded
SetScaling
Initialize matrix only with scaling factors
Parameters:
-
scaleX
(float
) –Scale in X axis.
-
scaleY
(float
) –Scale in Y axis.
-
scaleZ
(float
) –Scale in Z axis.
SetTranslation
SetTranslation(vec: Vector3D)
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..15>
-
value
(float
) –Value for set
Returns:
-
bool
–True when operation successful (index is not out of range), otherwise false.
SetValues
SetValues(
v00: float,
v01: float,
v02: float,
v03: float,
v10: float,
v11: float,
v12: float,
v13: float,
v20: float,
v21: float,
v22: float,
v23: float,
v30: float,
v31: float,
v32: float,
v33: float,
)
Sets each matrix-element
Parameters:
-
v00
(float
) –first row, first element
-
v01
(float
) –first row, second element
-
v02
(float
) –first row, third element
-
v03
(float
) –first row, fourth element
-
v10
(float
) –second row, first element
-
v11
(float
) –second row, second element
-
v12
(float
) –second row, third element
-
v13
(float
) –second row, fourth element
-
v20
(float
) –third row, first element
-
v21
(float
) –third row, second element
-
v22
(float
) –third row, third element
-
v23
(float
) –third row, fourth element
-
v30
(float
) –fourth row, first element
-
v31
(float
) –fourth row, second element
-
v32
(float
) –fourth row, third element
-
v33
(float
) –fourth row, fourth element
Translate
Translate(vec: Vector3D)
Transpose
Transpose matrix
All transform-services multiply transformation-matrix from the right side: If you need the result as it would be multiplication from the left side you need the transposed Matrix
__add__
__eq__
__eq__(mat: Matrix3D) -> bool
Comparison of matrices without tolerance.
Be careful, this method work without tolerance!
Parameters:
-
arc
–Compared arc.
Returns:
-
bool
–True when matrices are equal, otherwise false.
__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..15>
Returns:
-
float
–Returns an element at a specified position.
__iadd__
__imul__
__init__
overloaded
Initialize
__init__(proj: eProjectionMatrixType)
Constructor
Create a matrix for the required projection.
Parameters:
-
proj
(eProjectionMatrixType
) –The required projection
__init__(matrix: Matrix3D)
__init__(
v00: float,
v01: float,
v02: float,
v03: float,
v10: float,
v11: float,
v12: float,
v13: float,
v20: float,
v21: float,
v22: float,
v23: float,
v30: float,
v31: float,
v32: float,
v33: float,
)
Constructor setting each matrix-element
Parameters:
-
v00
(float
) –first row, first element
-
v01
(float
) –first row, second element
-
v02
(float
) –first row, third element
-
v03
(float
) –first row, fourth element
-
v10
(float
) –second row, first element
-
v11
(float
) –second row, second element
-
v12
(float
) –second row, third element
-
v13
(float
) –second row, fourth element
-
v20
(float
) –third row, first element
-
v21
(float
) –third row, second element
-
v22
(float
) –third row, third element
-
v23
(float
) –third row, fourth element
-
v30
(float
) –fourth row, first element
-
v31
(float
) –fourth row, second element
-
v32
(float
) –fourth row, third element
-
v33
(float
) –fourth row, fourth element
Constructor
Parameters:
-
valuesinrows
(list
) –matrix values by rows as Python list