Class Matrix
A column-ordered 3x4 matrix. The first 3 columns represent the X, Y, and Z axes of the coordinate system. The fourth column represents the translation of the coordinate system.
Inheritance
Implements
Inherited Members
Namespace: Elements.Geometry
Assembly: Hypar.Elements.dll
Syntax
public class Matrix : IEquatable<Matrix>
Constructors
Matrix()
Construct a 4X3 matrix.
Declaration
public Matrix()
Matrix(Vector3, Vector3, Vector3, Vector3)
Construct a matrix from axes.
Declaration
public Matrix(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | xAxis | The X axis. |
Vector3 | yAxis | The Y axis. |
Vector3 | zAxis | The Z axis. |
Vector3 | translation | The translation. |
Matrix(Double[])
Construct a matrix.
Declaration
[JsonConstructor]
public Matrix(double[] components)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | components | The components of the matrix. |
Properties
Components
The components of the matrix.
Declaration
[JsonProperty("Components", Required = Required.Always)]
[Required]
[MinLength(12)]
[MaxLength(12)]
public double[] Components { get; set; }
Property Value
Type | Description |
---|---|
System.Double[] |
m11
m11
Declaration
[JsonIgnore]
public double m11 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m12
m12
Declaration
[JsonIgnore]
public double m12 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m13
m13
Declaration
[JsonIgnore]
public double m13 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m21
m21
Declaration
[JsonIgnore]
public double m21 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m22
m22
Declaration
[JsonIgnore]
public double m22 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m23
m23
Declaration
[JsonIgnore]
public double m23 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m31
m31
Declaration
[JsonIgnore]
public double m31 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m32
m32
Declaration
[JsonIgnore]
public double m32 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
m33
m33
Declaration
[JsonIgnore]
public double m33 { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Translation
The translation component of the Matrix.
Declaration
[JsonIgnore]
public Vector3 Translation { get; }
Property Value
Type | Description |
---|---|
Vector3 |
tx
tx
Declaration
[JsonIgnore]
public double tx { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ty
ty
Declaration
[JsonIgnore]
public double ty { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
tz
tz
Declaration
[JsonIgnore]
public double tz { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XAxis
The X axis of the Matrix.
Declaration
[JsonIgnore]
public Vector3 XAxis { get; }
Property Value
Type | Description |
---|---|
Vector3 |
YAxis
The Y axis of the Matrix.
Declaration
[JsonIgnore]
public Vector3 YAxis { get; }
Property Value
Type | Description |
---|---|
Vector3 |
ZAxis
The Z axis of the Matrix.
Declaration
[JsonIgnore]
public Vector3 ZAxis { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
Determinant()
Compute the determinant of the 3x3 portion of the matrix.
Declaration
public double Determinant()
Returns
Type | Description |
---|---|
System.Double |
Equals(Matrix)
Is this matrix equal to other?
Declaration
public bool Equals(Matrix other)
Parameters
Type | Name | Description |
---|---|---|
Matrix | other | The transform to test. |
Returns
Type | Description |
---|---|
System.Boolean | True if the two transforms are equal, otherwise false. |
GetHashCode()
Get the hash code for the matrix.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Inverse()
Compute the inverse of the matrix.
Declaration
[Obsolete("Use Matrix.Inverted() instead.")]
public Matrix Inverse()
Returns
Type | Description |
---|---|
Matrix |
Inverted()
Compute the inverse of the matrix.
Declaration
public Matrix Inverted()
Returns
Type | Description |
---|---|
Matrix |
SetIdentity()
Set the matrix to identity.
Declaration
public void SetIdentity()
SetTranslation(Vector3)
Set the translation of the matrix.
Declaration
public void SetTranslation(Vector3 v)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | v | The translation vector. |
SetupProject(Plane)
Setup the matrix to project.
Declaration
public void SetupProject(Plane p)
Parameters
Type | Name | Description |
---|---|---|
Plane | p | The plane on which to project. |
SetupReflect(Vector3)
Setup the matrix to reflect about a plane with normal n.
Declaration
public void SetupReflect(Vector3 n)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | n | The normal of the reflection plane. |
SetupRotate(Vector3, Double)
Setup the matrix to perform rotation.
Declaration
public void SetupRotate(Vector3 axis, double theta)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The axis of rotation. |
System.Double | theta | The angle of rotation in radians. |
SetupRotate(Int32, Double)
Setup the matrix to rotate.
Declaration
public void SetupRotate(int axis, double theta)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | axis | The axis of rotation. 1-x, 2-y, 3-z |
System.Double | theta | The angle of rotation in radians. |
SetupScale(Vector3)
Setup the matrix to scale.
Declaration
public void SetupScale(Vector3 s)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | s | The scale value. |
SetupTranslation(Vector3)
Setup the matrix to translate.
Declaration
public void SetupTranslation(Vector3 v)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | v | The translation. |
ToString()
Return the string representation of the matrix.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Transpose()
Transpose the matrix.
Declaration
public Matrix Transpose()
Returns
Type | Description |
---|---|
Matrix |
ZeroTranslation()
Set the translation of the matrix to zero.
Declaration
public void ZeroTranslation()
Operators
Multiply(Matrix, Matrix)
Multiply two matrices.
Declaration
public static Matrix operator *(Matrix a, Matrix b)
Parameters
Type | Name | Description |
---|---|---|
Matrix | a | |
Matrix | b |
Returns
Type | Description |
---|---|
Matrix |
Multiply(Vector3, Matrix)
Transform the specified vector.
Declaration
public static Vector3 operator *(Vector3 p, Matrix m)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | p | The vector to transform. |
Matrix | m | The transformation matrix. |
Returns
Type | Description |
---|---|
Vector3 |