29 return m1._operator_mul(m2);
232 float s = (float)
Math.Sin(angleRadians);
233 float c = (float)
Math.Cos(angleRadians);
236 xBasis =
new Vector(n[0] * n[0] * C + c, n[0] * n[1] * C - n[2] * s, n[0] * n[2] * C + n[1] * s);
237 yBasis =
new Vector(n[1] * n[0] * C + n[2] * s, n[1] * n[1] * C + c, n[1] * n[2] * C - n[0] * s);
238 zBasis =
new Vector(n[2] * n[0] * C - n[1] * s, n[2] * n[1] * C + n[0] * s, n[2] * n[2] * C + c);
The Matrix struct represents a transformation matrix.
Matrix(Matrix other)
Constructs a copy of the specified Matrix object.
Vector yBasis
The basis vector for the y-axis.
void SetRotation(Vector axis, float angleRadians)
Sets this transformation matrix to represent a rotation around the specified vector.
Vector zBasis
The basis vector for the z-axis.
bool Equals(Matrix other)
Compare Matrix equality component-wise.
static Matrix operator*(Matrix m1, Matrix m2)
Multiply two matrices.
Matrix(Vector xBasis, Vector yBasis, Vector zBasis)
Constructs a transformation matrix from the specified basis vectors.
static readonly Matrix Identity
Returns the identity matrix specifying no translation, rotation, and scale.
Vector xBasis
The basis vector for the x-axis.
float[] ToArray4x4(float[] output)
Copy this matrix to the specified array of 16 float values in row-major order.
Matrix RigidInverse()
Performs a matrix inverse if the matrix consists entirely of rigid transformations (translations and ...
Vector TransformDirection(Vector direction)
Transforms a vector with this matrix by transforming its rotation and scale only.
Vector TransformPoint(Vector point)
Transforms a vector with this matrix by transforming its rotation, scale, and translation.
Matrix(Vector xBasis, Vector yBasis, Vector zBasis, Vector origin)
Constructs a transformation matrix from the specified basis and translation vectors.
float[] ToArray3x3(float[] output)
Copy this matrix to the specified array of 9 float values in row-major order.
Vector origin
The translation factors for all three axes.
Matrix(Vector axis, float angleRadians, Vector translation)
Constructs a transformation matrix specifying a rotation around the specified vector and a translatio...
double[] ToArray3x3(double[] output)
Copy this matrix to the specified array containing 9 double values in row-major order.
Matrix(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22, float m30, float m31, float m32)
Matrix(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
float[] ToArray4x4()
Convert this matrix to an array containing 16 float values in row-major order.
float[] ToArray3x3()
Convert this matrix to an array containing 9 float values in row-major order.
double[] ToArray4x4(double[] output)
Copy this matrix to the specified array of 16 double values in row-major order.
override string ToString()
Write the matrix to a string in a human readable format.
Matrix(Vector axis, float angleRadians)
Constructs a transformation matrix specifying a rotation around the specified vector.
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
static readonly Vector Zero
The zero vector: (0, 0, 0)
Vector Normalized
A normalized copy of this vector.
static readonly Vector ZAxis
The z-axis unit vector: (0, 0, 1)
static readonly Vector YAxis
The y-axis unit vector: (0, 1, 0)
static readonly Vector XAxis
The x-axis unit vector: (1, 0, 0)