RigidMatrix Type
A struct containing 12 floats, representing an immutable 4x3 rigid matrix. For only rotation and translation in 3D space. This matrix guarantees to NOT scale, shear, flip, mirror, reflect or project. Angles are preserved. Lengths are preserved. Area is preserved. Volume is preserved. A rigid matrix is a matrix whose 3x3 columns and rows are orthogonal unit-vectors. The matrix is represented in the following column-vector syntax form:
M11 M21 M31 X41
M12 M22 M32 Y42
M13 M23 M33 Z43
Where X41, Y42 and Z43 refer to the translation part of the RigidMatrix.
The Determinant of this matrix is always 1.0.
Note: Never use the struct default constructor RigidMatrix() as it will create an invalid zero RigidMatrix.
Use RigidMatrix.create instead.
Record fields
| Record Field |
Description
|
Full Usage:
M11
Field type: float
|
|
Full Usage:
M12
Field type: float
|
|
Full Usage:
M13
Field type: float
|
|
Full Usage:
M21
Field type: float
|
|
Full Usage:
M22
Field type: float
|
|
Full Usage:
M23
Field type: float
|
|
Full Usage:
M31
Field type: float
|
|
Full Usage:
M32
Field type: float
|
|
Full Usage:
M33
Field type: float
|
|
Full Usage:
X41
Field type: float
|
|
Full Usage:
Y42
Field type: float
|
|
Full Usage:
Z43
Field type: float
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format RigidMatrix into an F# code string that can be used to recreate the matrix.
|
Full Usage:
this.AsString
Returns: string
|
Nicely formats the Matrix to a Grid of 4x3.
|
|
Returns the first column vector. M11, M12 and M13.
|
|
Returns the second column vector. M21, M22 and M23.
|
|
Returns the third column vector. M31, M32 and M33.
|
|
Inverts the RigidMatrix. Rigid matrices always have determinant 1.0 so they can always be inverted.
|
Full Usage:
this.IsIdentity
Returns: bool
|
Checks if the Matrix is an Identity Matrix in the form of:
Using an approximate tolerance of 1e-6.
|
|
Converts the 3x4 RigidMatrix to a general 4x4 Matrix.
|
Full Usage:
this.ToArrayByColumns
Returns: float[]
|
Returns the 12 elements column-major order:
Where X41, Y42 and Z43 refer to the translation part of the RigidMatrix.
|
Full Usage:
this.ToArrayByRows
Returns: float[]
|
Returns the 12 elements in row-major order:
Where X41, Y42 and Z43 refer to the translation part of the RigidMatrix.
|
|
Returns the translation or fourth column vector. X41, Y42 and Z43.
|
Static members
| Static member |
Description
|
Full Usage:
v *** m
Parameters:
Pnt
-
The 3D point to transform.
m : RigidMatrix
-
The transformation matrix.
Returns: Pnt
Modifiers: inline |
Multiplies (or applies) a RigidMatrix to a 3D point.
|
Full Usage:
v *** m
Parameters:
UnitVec
-
The 3D unit-vector to transform.
m : RigidMatrix
-
The transformation matrix.
Returns: UnitVec
Modifiers: inline |
Multiplies (or applies) a RigidMatrix to a 3D unit-vector. Since a 3D vector represents a direction or translation in space, but not a location, all translations are ignored. (Homogeneous Vector)
|
Full Usage:
v *** m
Parameters:
Vec
-
The 3D vector to transform.
m : RigidMatrix
-
The transformation matrix.
Returns: Vec
Modifiers: inline |
Multiplies (or applies) a RigidMatrix to a 3D vector. Since a 3D vector represents a direction or translation in space, but not a location, all translations are ignored. (Homogeneous Vector)
|
Full Usage:
matrixA *** matrixB
Parameters:
RigidMatrix
-
The first matrix (applied first).
matrixB : RigidMatrix
-
The second matrix (applied second).
Returns: RigidMatrix
Modifiers: inline |
Multiplies matrixA with matrixB. The resulting transformation will first do matrixA and then matrixB.
|
Full Usage:
RigidMatrix.addTranslation v m
Parameters:
Vec
-
The translation vector to add.
m : RigidMatrix
-
The matrix to modify.
Returns: RigidMatrix
|
Add a vector translation to an existing RigidMatrix.
|
Full Usage:
RigidMatrix.addTranslationXYZ x y z m
Parameters:
float
-
The X translation to add.
y : float
-
The Y translation to add.
z : float
-
The Z translation to add.
m : RigidMatrix
-
The matrix to modify.
Returns: RigidMatrix
|
Add a X, Y and Z translation to an existing RigidMatrix.
|
Full Usage:
RigidMatrix.create (m11, m21, m31, x41, m12, m22, m32, y42, m13, m23, m33, z43)
Parameters:
float
m21 : float
m31 : float
x41 : float
m12 : float
m22 : float
m32 : float
y42 : float
m13 : float
m23 : float
m33 : float
z43 : float
Returns: RigidMatrix
|
Create immutable a 4x3 Transformation Matrix. Checks the input values to ensure they form a valid RigidMatrix. This Constructor takes arguments in row-major order:
Where X41, Y42 and Z43 refer to the translation part of the RigidMatrix.
|
Full Usage:
RigidMatrix.createFromMatrix m
Parameters:
Matrix
-
The general 4x4 matrix to convert.
Returns: RigidMatrix
|
Tries to create a 3x4 RigidMatrix from a general 4x4 matrix. Fails if the input matrix does scale, shear, flip, mirror, reflect or project. However, translation is allowed.
|
Full Usage:
RigidMatrix.createFromQuaternion quaternion
Parameters:
Quaternion
-
The quaternion representing the rotation.
Returns: RigidMatrix
|
Create a RigidMatrix from a Quaternion.
|
|
Creates a RigidMatrix to transform from one Plane or Coordinate System to another Plane.
|
Full Usage:
RigidMatrix.createRotationAxis (axis, angleDegrees)
Parameters:
Vec
-
Rotation axis, a vector of any length but 0.0.
angleDegrees : float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation around an Axis RigidMatrix. A positive angle rotates counter-clockwise when the axis vector is pointing towards the observer (right-hand rule).
|
Full Usage:
RigidMatrix.createRotationAxis (axis, angleDegrees)
Parameters:
UnitVec
-
Rotation axis, as unit-vector.
angleDegrees : float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation around an Axis RigidMatrix. A positive angle rotates counter-clockwise when the axis vector is pointing towards the observer (right-hand rule).
|
Full Usage:
RigidMatrix.createRotationAxisCenter (axis, cen, angleDegrees)
Parameters:
UnitVec
-
Rotation axis, a unit-vector.
cen : Pnt
-
The center point for the rotation.
angleDegrees : float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation matrix around an Axis at a given center point. A positive angle rotates counter-clockwise when the axis vector is pointing towards the observer (right-hand rule).
|
Full Usage:
RigidMatrix.createRotationAxisCenter (axis, cen, angleDegrees)
Parameters:
Vec
-
Rotation axis, a vector of any length but 0.0.
cen : Pnt
-
The center point for the rotation.
angleDegrees : float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation matrix around an Axis at a given center point. A positive angle rotates counter-clockwise when the axis vector is pointing towards the observer (right-hand rule).
|
Full Usage:
RigidMatrix.createRotationX angleDegrees
Parameters:
float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation around the X-axis RigidMatrix by angle in Degrees (not Radians). A positive rotation will be from Y towards Z-axis, so counter-clockwise when the X-axis vector is pointing towards the observer. (right-hand rule) The resulting RigidMatrix will be:
val cos: value: 'T -> 'T (requires member Cos)
val sin: value: 'T -> 'T (requires member Sin)
|
Full Usage:
RigidMatrix.createRotationY angleDegrees
Parameters:
float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation around the Y-axis RigidMatrix by angle in Degrees (not Radians). A positive rotation will be from Z towards X-axis, so counter-clockwise when the Y-axis vector is pointing towards the observer.( right-hand rule) The resulting RigidMatrix will be:
val cos: value: 'T -> 'T (requires member Cos)
val sin: value: 'T -> 'T (requires member Sin)
|
Full Usage:
RigidMatrix.createRotationZ angleDegrees
Parameters:
float
-
Rotation angle in Degrees.
Returns: RigidMatrix
|
Creates a rotation around the Z-axis RigidMatrix by angle in Degrees (not Radians). A positive rotation will be from X toward Y-axis, so counter-clockwise when the Z-axis vector is pointing towards the observer. (right-hand rule) The resulting RigidMatrix will be:
val cos: value: 'T -> 'T (requires member Cos)
val sin: value: 'T -> 'T (requires member Sin)
|
Full Usage:
RigidMatrix.createToPlane p
Parameters:
PPlane
-
The target plane.
Returns: RigidMatrix
|
Creates a RigidMatrix to transform from World plane or Coordinate System to given Plane. Also called Change of Basis.
|
Full Usage:
RigidMatrix.createTranslation v
Parameters:
Vec
-
The vector by which to translate.
Returns: RigidMatrix
|
Creates a translation RigidMatrix. The resulting RigidMatrix will be:
|
Full Usage:
RigidMatrix.createTranslation (x, y, z)
Parameters:
float
-
The amount to translate in the X-axis.
y : float
-
The amount to translate in the Y-axis.
z : float
-
The amount to translate in the Z-axis.
Returns: RigidMatrix
|
Creates a translation RigidMatrix. The resulting matrix will be:
|
Full Usage:
RigidMatrix.createTranslationX x
Parameters:
float
-
The amount by which to translate in X-axis.
Returns: RigidMatrix
|
Creates a translation RigidMatrix. The resulting RigidMatrix will be:
|
Full Usage:
RigidMatrix.createTranslationY y
Parameters:
float
-
The amount by which to translate in Y-axis.
Returns: RigidMatrix
|
Creates a translation RigidMatrix. The resulting RigidMatrix will be:
|
Full Usage:
RigidMatrix.createTranslationZ z
Parameters:
float
-
The amount by which to translate in Z-axis.
Returns: RigidMatrix
|
Creates a translation RigidMatrix. The resulting RigidMatrix will be:
|
|
Creates a rotation from one vectors direction to another vectors direction. If the tips of the two unitized vectors have a distance less than 1e-12 the identity matrix is returned. If the tips of the two vectors are almost exactly opposite, that is if tips of the two vectors are less than 1e-12 apart when summed, there is no valid unique 180 degree rotation that can be found, so an exception is raised. Fails if either vector is too short (length less than 1e-6).
|
Full Usage:
RigidMatrix.createVecToVec (vecFrom, vecTo)
Parameters:
UnitVec
-
The source unit-vector direction.
vecTo : UnitVec
-
The target unit-vector direction.
Returns: RigidMatrix
|
Creates a rotation from one unit-vectors direction to another unit-vectors direction. If the tips of the two unitized vectors have a distance less than 1e-12 the identity matrix is returned. If the tips of the two vectors are almost exactly opposite, that is if tips of the two vectors are less than 1e-12 apart when summed, there is no valid unique 180 degree rotation that can be found, so an exception is raised.
|
Full Usage:
RigidMatrix.equals tol a b
Parameters:
float
-
The tolerance for comparing each matrix element.
a : RigidMatrix
-
The first matrix.
b : RigidMatrix
-
The second matrix.
Returns: bool
|
Checks if two Matrices are equal within tolerance. By comparing the fields M11 to Z43 each with the given tolerance. Use a tolerance of 0.0 to check for an exact match.
|
|
Returns the Identity RigidMatrix:
|
Full Usage:
RigidMatrix.inverse m
Parameters:
RigidMatrix
-
The matrix to invert.
Returns: RigidMatrix
Modifiers: inline |
Inverts the RigidMatrix. A RigidMatrix can always be inverted. (as opposed to a general Matrix)
|
Full Usage:
RigidMatrix.multiply (matrixA, matrixB)
Parameters:
RigidMatrix
-
The first matrix (applied first).
matrixB : RigidMatrix
-
The second matrix (applied second).
Returns: RigidMatrix
|
Multiplies matrixA with matrixB. The resulting transformation will first do matrixA and then matrixB.
|
Full Usage:
RigidMatrix.removeTranslation m
Parameters:
RigidMatrix
-
The matrix to modify.
Returns: RigidMatrix
|
Removes the translation part by setting X41, Y42 and Z43 to 0.0.
|
Full Usage:
RigidMatrix.toMatrix m
Parameters:
RigidMatrix
-
The RigidMatrix to convert.
Returns: Matrix
|
Converts the 3x4 RigidMatrix to a general 4x4 Matrix.
|
Full Usage:
RigidMatrix.tryCreateFromMatrix m
Parameters:
Matrix
-
The general 4x4 matrix to convert.
Returns: RigidMatrix option
|
Tries to create a 3x4 RigidMatrix from a general 4x4 matrix. Returns None if the input matrix does scale, shear, flip, mirror, reflect or project. However, translation is allowed.
|
Euclid