Struct TMatrix
Last update: 03.07.2024
Struct TMatrix
Namespace: VM
Assembly: VM.dll
public struct TMatrix : IOMatrix
Implements
Constructors
TMatrix(TMatrix)
Copy construct transformation matrix
public TMatrix(TMatrix mat)
Parameters
mat
TMatrix
The matrix to copy
TMatrix(Plane, Vector, Vector, Vector?)
Initializes a new instance of the
public TMatrix(Plane type, Vector vecMaster, Vector vecSlave, Vector? vecPos = null)
Parameters
type
Plane
The type of plane.
vecMaster
Vector
The vector for master.
vecSlave
Vector
The vector for slave.
vecPos
Vector?
The position.
TMatrix(double[])
Initializes a new instance of the
public TMatrix(double[] arr)
Parameters
arr
double[]
The data of orientation.
Properties
Array
Get/Set the array of matrix value
public double[] Array { get; set; }
Property Value
double[]
Identity
Gets the Identity Transformation Matrix.
public static TMatrix Identity { get; }
Property Value
InverseTransformationMatrix
Gets the matrix of inverse transform.
public TMatrix InverseTransformationMatrix { get; }
Property Value
Exceptions
The inverse transform of matrix operation failed.
Orientation
Get Orientation vector of matrix
public OMatrix Orientation { get; }
Property Value
Position
Get/Set Position vector of matrix
public Vector Position { get; set; }
Property Value
XVector
Get/Set X vector of matrix
public Vector XVector { get; set; }
Property Value
YVector
Get/Set Y vector of matrix
public Vector YVector { get; set; }
Property Value
ZVector
Get/Set Z vector of matrix
public Vector ZVector { get; set; }
Property Value
this[int]
public Vector this[int nIndex] { get; set; }
Property Value
this[Coordinate]
Get/Set the specific vector of matrix
public Vector this[Coordinate enIndex] { get; set; }
Property Value
this[int, int]
public double this[int nRow, int nCol] { get; set; }
Property Value
this[Coordinate, Coordinate]
Get/Set the specific value of matrix element
public double this[Coordinate enRow, Coordinate enCol] { get; set; }
Property Value
Methods
CopyTo(double[], int)
Copy matrix values to the array
public void CopyTo(double[] arr, int nStartIndex)
Parameters
arr
double[]
The array values copied to
nStartIndex
int
The start index of array
Exceptions
The condition : 16 > arr.Length - nStartIndex
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
object
The object to compare.
Returns
true if the objects are equal, otherwise false.
GetDirectionVector(Coordinate)
Get the direction vector for axis.
public Vector GetDirectionVector(Coordinate axis)
Parameters
axis
Coordinate
The type of axis.
Returns
The direction vector.
GetDirectionVector(int)
Get the direction vector for axis.
public Vector GetDirectionVector(int axis)
Parameters
axis
int
The type of axis.
Returns
The direction vector.
GetHashCode()
Returns the hash code for this vector
public override int GetHashCode()
Returns
A 32-bit signed integer hash code.
Initialize()
Initialize the Orientation Matrix
public void Initialize()
Normalize()
Normalize the Orientation Matrix
public void Normalize()
Exceptions
The normalize operation failed .
RotateAxisDeg(Coordinate, double)
To rotate counterclockwise for coordinate.
public void RotateAxisDeg(Coordinate c, double dAngle)
Parameters
The rotation coordinate.
dAngle
double
The degree.
Exceptions
The rotate operation failed .
RotateAxisDeg(int, double)
To rotate counterclockwise for coordinate.
public void RotateAxisDeg(int nCoord, double dAngle)
Parameters
nCoord
int
The rotation coordinate.
dAngle
double
The degree.
RotateAxisDeg(Vector, double)
To rotate counterclockwise for axis.
public void RotateAxisDeg(Vector axis, double dAngle)
Parameters
axis
Vector
The rotation axis.
dAngle
double
The degree.
Exceptions
The rotate operation failed .
RotateAxisRad(Coordinate, double)
To rotate counterclockwise for coordinate.
public void RotateAxisRad(Coordinate c, double dAngle)
Parameters
The rotation coordinate.
dAngle
double
The radian.
Exceptions
The rotate operation failed .
RotateAxisRad(int, double)
To rotate counterclockwise for coordinate.
public void RotateAxisRad(int nCoord, double dAngle)
Parameters
nCoord
int
The rotation coordinate.
dAngle
double
The radian.
RotateAxisRad(Vector, double)
To rotate counterclockwise for axis.
public void RotateAxisRad(Vector axis, double dAngle)
Parameters
axis
Vector
The rotation axis.
dAngle
double
The radian.
Exceptions
The rotate operation failed .
RotateXDeg(double)
To rotate counterclockwise for x-axis.
public void RotateXDeg(double dAngle)
Parameters
dAngle
double
The degree.
Exceptions
The rotate operation failed .
RotateXRad(double)
To rotate counterclockwise for x-axis.
public void RotateXRad(double dAngle)
Parameters
dAngle
double
The radian.
Exceptions
The rotate operation failed .
RotateYDeg(double)
To rotate counterclockwise for y-axis.
public void RotateYDeg(double dAngle)
Parameters
dAngle
double
The degree.
Exceptions
The rotate operation failed .
RotateYRad(double)
To rotate counterclockwise for y-axis.
public void RotateYRad(double dAngle)
Parameters
dAngle
double
The radian.
Exceptions
The rotate operation failed .
RotateZDeg(double)
To rotate counterclockwise for z-axis.
public void RotateZDeg(double dAngle)
Parameters
dAngle
double
The degree.
Exceptions
The rotate operation failed .
RotateZRad(double)
To rotate counterclockwise for z-axis.
public void RotateZRad(double dAngle)
Parameters
dAngle
double
The radian.
Exceptions
The rotate operation failed .
Set(TMatrix)
Set data of transformation.
public void Set(TMatrix mat)
Parameters
mat
TMatrix
The transform matrix.
Set(double[])
Set data of transformation.
public void Set(double[] arr)
Parameters
arr
double[]
The transform array.
SetOrientation(Plane, Vector, Vector)
Set data of orientation.
public void SetOrientation(Plane type, Vector vecMaster, Vector vecSlave)
Parameters
type
Plane
The type of plane.
vecMaster
Vector
The vector for master.
vecSlave
Vector
The vector for slave.
Exceptions
The set data of orientation operation failed .
SetOrientation(OMatrix)
Set data of orientation.
public void SetOrientation(OMatrix mat)
Parameters
mat
OMatrix
The matrix of orientation.
SetOrientation(double[])
Set data of orientation.
public void SetOrientation(double[] arr)
Parameters
arr
double[]
The data of orientation.
SetOrientationEADeg(RotationAxes, double, double, double)
Set data of orientation for euler angle. Unit is degree.
public void SetOrientationEADeg(RotationAxes ea, double dAlpha, double dBeta, double dGamma)
Parameters
ea
RotationAxes
The type of euler angle.
dAlpha
double
The alpha of euler angle.
dBeta
double
The beta of euler angle.
dGamma
double
The gamma of euler angle.
Exceptions
The set data of orientation operation failed .
SetOrientationEARad(RotationAxes, double, double, double)
Set data of orientation for euler angle. Unit is radian.
public void SetOrientationEARad(RotationAxes ea, double dAlpha, double dBeta, double dGamma)
Parameters
ea
RotationAxes
The type of euler angle.
dAlpha
double
The alpha of euler angle.
dBeta
double
The beta of euler angle.
dGamma
double
The gamma of euler angle.
Exceptions
The set data of orientation operation failed .
SetOrientationFixedAngleDeg(RotationAxes, double, double, double)
Set data of orientation for fixed angle. Unit is degree.
public void SetOrientationFixedAngleDeg(RotationAxes ea, double dAlpha, double dBeta, double dGamma)
Parameters
ea
RotationAxes
The type of fixed angle.
dAlpha
double
The alpha of fixed angle.
dBeta
double
The beta of fixed angle.
dGamma
double
The gamma of fixed angle.
Exceptions
The set data of orientation operation failed .
SetOrientationFixedAngleRad(RotationAxes, double, double, double)
Set data of orientation for fixed angle. Unit is radian.
public void SetOrientationFixedAngleRad(RotationAxes ea, double dAlpha, double dBeta, double dGamma)
Parameters
ea
RotationAxes
The type of fixed angle.
dAlpha
double
The alpha of fixed angle.
dBeta
double
The beta of fixed angle.
dGamma
double
The gamma of fixed angle.
Exceptions
The set data of orientation operation failed .
SetPositionVector(Vector)
Set the position vector.
public void SetPositionVector(Vector vec)
Parameters
vec
Vector
The vector.
ToString()
public override string ToString()
Returns
Translate(Vector)
To translate for position.
public void Translate(Vector vec)
Parameters
vec
Vector
The vector
Translate(double, double, double)
To translate for position.
public void Translate(double dX, double dY, double dZ)
Parameters
dX
double
The value of X
dY
double
The value of y
dZ
double
The value of z
TransposeOrientation()
Transposed rows and columns of the matrix.
public void TransposeOrientation()
Exceptions
The transpose operation failed .
Operators
operator ==(TMatrix, TMatrix)
Compare two transformation matrices are same or not
public static bool operator ==(TMatrix matLeft, TMatrix matRight)
Parameters
matLeft
TMatrix
The left matrix to compare
matRight
TMatrix
The right matrix to compare
Returns
true if two matrices are same, otherwise false.
Exceptions
The equality operation failed .
operator !=(TMatrix, TMatrix)
Compare two transformation matrices are same or not
public static bool operator !=(TMatrix matLeft, TMatrix matRight)
Parameters
matLeft
TMatrix
The left matrix to compare
matRight
TMatrix
The right matrix to compare
Returns
true if two matrices are not same, otherwise false.
Exceptions
The inequality operation failed .
operator *(TMatrix, TMatrix)
Cross product two orientation matrices.
public static TMatrix operator *(TMatrix matA, TMatrix matB)
Parameters
matA
TMatrix
The left matrix to cross product
matB
TMatrix
The right matrix to cross product
Returns
The cross product matrix.
Exceptions
The multiply operation failed .
operator *(Vector, TMatrix)
Multiply vector to the matrix.
public static Vector operator *(Vector vec, TMatrix mat)
Parameters
vec
Vector
The vector to multiply value
mat
TMatrix
The matrix to multiply
Returns
The Multiplied vector.
Exceptions
The multiply operation failed .