Struct XMMatrix
Describes a 4*4 matrix.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.DXMath
Assembly: JeremyAnsel.DirectX.DXMath.dll
Syntax
public struct XMMatrix : IEquatable<XMMatrix>
Constructors
| Edit this page View SourceXMMatrix(XMVector, XMVector, XMVector, XMVector)
Initializes a new instance of the XMMatrix struct.
Declaration
public XMMatrix(XMVector r1, XMVector r2, XMVector r3, XMVector r4)
Parameters
Type | Name | Description |
---|---|---|
XMVector | r1 | The first row. |
XMVector | r2 | The second row. |
XMVector | r3 | The third row. |
XMVector | r4 | The fourth row. |
XMMatrix(XMVector[])
Initializes a new instance of the XMMatrix struct.
Declaration
public XMMatrix(XMVector[] rows)
Parameters
Type | Name | Description |
---|---|---|
XMVector[] | rows | The rows. |
XMMatrix(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)
Initializes a new instance of the XMMatrix struct.
Declaration
public XMMatrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
Parameters
Type | Name | Description |
---|---|---|
float | m11 | The value in the first row and first column. |
float | m12 | The value in the first row and second column. |
float | m13 | The value in the first row and third column. |
float | m14 | The value in the first row and fourth column. |
float | m21 | The value in the second row and first column. |
float | m22 | The value in the second row and second column. |
float | m23 | The value in the second row and third column. |
float | m24 | The value in the second row and fourth column. |
float | m31 | The value in the third row and first column. |
float | m32 | The value in the third row and second column. |
float | m33 | The value in the third row and third column. |
float | m34 | The value in the third row and fourth column. |
float | m41 | The value in the fourth row and first column. |
float | m42 | The value in the fourth row and second column. |
float | m43 | The value in the fourth row and third column. |
float | m44 | The value in the fourth row and fourth column. |
XMMatrix(float[])
Initializes a new instance of the XMMatrix struct.
Declaration
public XMMatrix(float[] array)
Parameters
Type | Name | Description |
---|---|---|
float[] | array | The values. |
Properties
| Edit this page View SourceIdentity
Gets the identity matrix.
Declaration
public static XMMatrix Identity { get; }
Property Value
Type | Description |
---|---|
XMMatrix |
this[int, int]
Gets or sets a value specified by row and column.
Declaration
public float this[int row, int column] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | row | The row of the value. |
int | column | The column of the value. |
Property Value
Type | Description |
---|---|
float | A float value. |
M11
Gets or sets the value in the first row and first column.
Declaration
public float M11 { get; set; }
Property Value
Type | Description |
---|---|
float |
M12
Gets or sets the value in the first row and second column.
Declaration
public float M12 { get; set; }
Property Value
Type | Description |
---|---|
float |
M13
Gets or sets the value in the first row and third column.
Declaration
public float M13 { get; set; }
Property Value
Type | Description |
---|---|
float |
M14
Gets or sets the value in the first row and fourth column.
Declaration
public float M14 { get; set; }
Property Value
Type | Description |
---|---|
float |
M21
Gets or sets the value in the second row and first column.
Declaration
public float M21 { get; set; }
Property Value
Type | Description |
---|---|
float |
M22
Gets or sets the value in the second row and second column.
Declaration
public float M22 { get; set; }
Property Value
Type | Description |
---|---|
float |
M23
Gets or sets the value in the second row and third column.
Declaration
public float M23 { get; set; }
Property Value
Type | Description |
---|---|
float |
M24
Gets or sets the value in the second row and fourth column.
Declaration
public float M24 { get; set; }
Property Value
Type | Description |
---|---|
float |
M31
Gets or sets the value in the third row and first column.
Declaration
public float M31 { get; set; }
Property Value
Type | Description |
---|---|
float |
M32
Gets or sets the value in the third row and second column.
Declaration
public float M32 { get; set; }
Property Value
Type | Description |
---|---|
float |
M33
Gets or sets the value in the third row and third column.
Declaration
public float M33 { get; set; }
Property Value
Type | Description |
---|---|
float |
M34
Gets or sets the value in the third row and fourth column.
Declaration
public float M34 { get; set; }
Property Value
Type | Description |
---|---|
float |
M41
Gets or sets the value in the fourth row and first column.
Declaration
public float M41 { get; set; }
Property Value
Type | Description |
---|---|
float |
M42
Gets or sets the value in the fourth row and second column.
Declaration
public float M42 { get; set; }
Property Value
Type | Description |
---|---|
float |
M43
Gets or sets the value in the fourth row and third column.
Declaration
public float M43 { get; set; }
Property Value
Type | Description |
---|---|
float |
M44
Gets or sets the value in the fourth row and fourth column.
Declaration
public float M44 { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
| Edit this page View SourceAdd(XMMatrix, XMMatrix)
Computes the sum of two matrices.
Declaration
public static XMMatrix Add(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a matrix that is the sum of the two matrices. |
AffineTransformation(XMVector, XMVector, XMVector, XMVector)
Builds an affine transformation matrix.
Declaration
public static XMMatrix AffineTransformation(XMVector scaling, XMVector rotationOrigin, XMVector rotationQuaternion, XMVector translation)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scaling | Vector of scaling factors for each dimension. |
XMVector | rotationOrigin | Point identifying the center of rotation. |
XMVector | rotationQuaternion | Rotation factors. |
XMVector | translation | Translation offsets. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the affine transformation matrix, built from the scaling, rotation, and translation information. |
AffineTransformation2D(XMVector, XMVector, float, XMVector)
Builds a 2D affine transformation matrix in the xy plane.
Declaration
public static XMMatrix AffineTransformation2D(XMVector scaling, XMVector rotationOrigin, float rotation, XMVector translation)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scaling | 2D vector of scaling factors for the x-coordinate and y-coordinate. |
XMVector | rotationOrigin | 2D vector describing the center of rotation. |
float | rotation | Radian angle of rotation. |
XMVector | translation | 2D vector translation offsets. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the 2D affine transformation matrix. |
Decompose(out XMVector, out XMVector, out XMVector)
Breaks down a general 3D transformation matrix into its scalar, rotational, and translational components.
Declaration
public bool Decompose(out XMVector scale, out XMVector rotationQuaternion, out XMVector translation)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scale | The scaling factors applied along the x, y, and z-axes. |
XMVector | rotationQuaternion | A quaternion that describes the rotation. |
XMVector | translation | A translation along the x, y, and z-axes. |
Returns
Type | Description |
---|---|
bool | If the function succeeds, the return value is true. If the function fails, the return value is false. |
Determinant()
Computes the determinant of a matrix.
Declaration
public XMVector Determinant()
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The determinant of M is replicated into each component. |
Divide(XMMatrix, float)
Divide each element of a matrix by a scalar.
Declaration
public static XMMatrix Divide(XMMatrix m, float s)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
float | s | The scalar. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
Equals(XMMatrix)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(XMMatrix other)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
Overrides
| Edit this page View SourceGetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceInverse()
Computes the inverse of a matrix.
Declaration
public XMMatrix Inverse()
Returns
Type | Description |
---|---|
XMMatrix | Returns the matrix inverse of M. If there is no inverse (that is, if the determinant is 0), returns an infinite matrix. |
Inverse(out XMVector)
Computes the inverse of a matrix.
Declaration
public XMMatrix Inverse(out XMVector determinant)
Parameters
Type | Name | Description |
---|---|---|
XMVector | determinant | A vector, each of whose components is the determinant of M. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the matrix inverse of M. If there is no inverse (that is, if the determinant is 0), returns an infinite matrix. |
IsIdentity()
Tests whether a matrix is the identity matrix.
Declaration
public bool IsIdentity()
Returns
Type | Description |
---|---|
bool | Returns true if M is the identity matrix, and false otherwise. |
IsInfinite()
Tests whether any of the elements of a matrix are positive or negative infinity.
Declaration
public bool IsInfinite()
Returns
Type | Description |
---|---|
bool | Returns true if any element of M is either positive or negative infinity, and false otherwise. |
IsNaN()
Tests whether any of the elements of a matrix are NaN.
Declaration
public bool IsNaN()
Returns
Type | Description |
---|---|
bool | Returns true if any element of M is NaN, and false otherwise. |
LoadFloat3X3(XMFloat3X3)
Loads an XMFloat3X3 into an XMMatrix.
Declaration
public static XMMatrix LoadFloat3X3(XMFloat3X3 source)
Parameters
Type | Name | Description |
---|---|---|
XMFloat3X3 | source | The structure to load. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
LoadFloat4X3(XMFloat4X3)
Loads an XMFloat4X3 into an XMMatrix.
Declaration
public static XMMatrix LoadFloat4X3(XMFloat4X3 source)
Parameters
Type | Name | Description |
---|---|---|
XMFloat4X3 | source | The structure to load. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
LoadFloat4X4(XMFloat4X4)
Loads an XMFloat4X4 into an XMMatrix.
Declaration
public static XMMatrix LoadFloat4X4(XMFloat4X4 source)
Parameters
Type | Name | Description |
---|---|---|
XMFloat4X4 | source | The structure to load. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
LookAtLH(XMVector, XMVector, XMVector)
Builds a view matrix for a left-handed coordinate system using a camera position, an up direction, and a focal point.
Declaration
public static XMMatrix LookAtLH(XMVector eyePosition, XMVector focusPosition, XMVector directionUp)
Parameters
Type | Name | Description |
---|---|---|
XMVector | eyePosition | Position of the camera. |
XMVector | focusPosition | Position of the focal point. |
XMVector | directionUp | Up direction of the camera. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a view matrix that transforms a point from world space into view space. |
LookAtRH(XMVector, XMVector, XMVector)
Builds a view matrix for a right-handed coordinate system using a camera position, an up direction, and a focal point.
Declaration
public static XMMatrix LookAtRH(XMVector eyePosition, XMVector focusPosition, XMVector directionUp)
Parameters
Type | Name | Description |
---|---|---|
XMVector | eyePosition | Position of the camera. |
XMVector | focusPosition | Position of the focal point. |
XMVector | directionUp | Up direction of the camera. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a view matrix that transforms a point from world space into view space. |
LookToLH(XMVector, XMVector, XMVector)
Builds a view matrix for a left-handed coordinate system using a camera position, an up direction, and a camera direction.
Declaration
public static XMMatrix LookToLH(XMVector eyePosition, XMVector eyeDirection, XMVector directionUp)
Parameters
Type | Name | Description |
---|---|---|
XMVector | eyePosition | Position of the camera. |
XMVector | eyeDirection | Direction of the camera. |
XMVector | directionUp | Up direction of the camera. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a view matrix that transforms a point from world space into view space. |
LookToRH(XMVector, XMVector, XMVector)
Builds a view matrix for a right-handed coordinate system using a camera position, an up direction, and a camera direction.
Declaration
public static XMMatrix LookToRH(XMVector eyePosition, XMVector eyeDirection, XMVector directionUp)
Parameters
Type | Name | Description |
---|---|---|
XMVector | eyePosition | Position of the camera. |
XMVector | eyeDirection | Direction of the camera. |
XMVector | directionUp | Up direction of the camera. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a view matrix that transforms a point from world space into view space. |
Multiply(XMMatrix, XMMatrix)
Computes the product of two matrices.
Declaration
public static XMMatrix Multiply(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the product of M1 and M2. |
Multiply(XMMatrix, float)
Multiply each element of a matrix by a scalar.
Declaration
public static XMMatrix Multiply(XMMatrix m, float s)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
float | s | The scalar. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
MultiplyTranspose(XMMatrix, XMMatrix)
Computes the transpose of the product of two matrices.
Declaration
public static XMMatrix MultiplyTranspose(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the transpose of the product of M1 and M2. |
Negate(XMMatrix)
Computes the negation of a matrix.
Declaration
public static XMMatrix Negate(XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the negation of the matrix. |
OrthographicLH(float, float, float, float)
Builds an orthogonal projection matrix for a left-handed coordinate system.
Declaration
public static XMMatrix OrthographicLH(float viewWidth, float viewHeight, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewWidth | Width of the frustum at the near clipping plane. |
float | viewHeight | Height of the frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the orthogonal projection matrix. |
OrthographicOffCenterLH(float, float, float, float, float, float)
Builds a custom orthogonal projection matrix for a left-handed coordinate system.
Declaration
public static XMMatrix OrthographicOffCenterLH(float viewLeft, float viewRight, float viewBottom, float viewTop, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewLeft | Minimum x-value of the view volume. |
float | viewRight | Maximum x-value of the view volume. |
float | viewBottom | Minimum y-value of the view volume. |
float | viewTop | Maximum y-value of the view volume. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the custom orthogonal projection matrix. |
OrthographicOffCenterRH(float, float, float, float, float, float)
Builds a custom orthogonal projection matrix for a right-handed coordinate system.
Declaration
public static XMMatrix OrthographicOffCenterRH(float viewLeft, float viewRight, float viewBottom, float viewTop, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewLeft | Minimum x-value of the view volume. |
float | viewRight | Maximum x-value of the view volume. |
float | viewBottom | Minimum y-value of the view volume. |
float | viewTop | Maximum y-value of the view volume. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the custom orthogonal projection matrix. |
OrthographicRH(float, float, float, float)
Builds an orthogonal projection matrix for a right-handed coordinate system.
Declaration
public static XMMatrix OrthographicRH(float viewWidth, float viewHeight, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewWidth | Width of the frustum at the near clipping plane. |
float | viewHeight | Height of the frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the orthogonal projection matrix. |
PerspectiveFovLH(float, float, float, float)
Builds a left-handed perspective projection matrix based on a field of view.
Declaration
public static XMMatrix PerspectiveFovLH(float fovAngleY, float aspectHByW, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | fovAngleY | Top-down field-of-view angle in radians. |
float | aspectHByW | Aspect ratio of view-space X:Y. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the perspective projection matrix. |
PerspectiveFovRH(float, float, float, float)
Builds a right-handed perspective projection matrix based on a field of view.
Declaration
public static XMMatrix PerspectiveFovRH(float fovAngleY, float aspectHByW, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | fovAngleY | Top-down field-of-view angle in radians. |
float | aspectHByW | Aspect ratio of view-space X:Y. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the perspective projection matrix. |
PerspectiveLH(float, float, float, float)
Builds a left-handed perspective projection matrix.
Declaration
public static XMMatrix PerspectiveLH(float viewWidth, float viewHeight, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewWidth | Width of the frustum at the near clipping plane. |
float | viewHeight | Height of the frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the perspective projection matrix. |
PerspectiveOffCenterLH(float, float, float, float, float, float)
Builds a custom version of a left-handed perspective projection matrix.
Declaration
public static XMMatrix PerspectiveOffCenterLH(float viewLeft, float viewRight, float viewBottom, float viewTop, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewLeft | The x-coordinate of the left side of the clipping frustum at the near clipping plane. |
float | viewRight | The x-coordinate of the right side of the clipping frustum at the near clipping plane. |
float | viewBottom | The y-coordinate of the bottom side of the clipping frustum at the near clipping plane. |
float | viewTop | The y-coordinate of the top side of the clipping frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the custom perspective projection matrix. |
PerspectiveOffCenterRH(float, float, float, float, float, float)
Builds a custom version of a right-handed perspective projection matrix.
Declaration
public static XMMatrix PerspectiveOffCenterRH(float viewLeft, float viewRight, float viewBottom, float viewTop, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewLeft | The x-coordinate of the left side of the clipping frustum at the near clipping plane. |
float | viewRight | The x-coordinate of the right side of the clipping frustum at the near clipping plane. |
float | viewBottom | The y-coordinate of the bottom side of the clipping frustum at the near clipping plane. |
float | viewTop | The y-coordinate of the top side of the clipping frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the custom perspective projection matrix. |
PerspectiveRH(float, float, float, float)
Builds a right-handed perspective projection matrix.
Declaration
public static XMMatrix PerspectiveRH(float viewWidth, float viewHeight, float nearZ, float farZ)
Parameters
Type | Name | Description |
---|---|---|
float | viewWidth | Width of the frustum at the near clipping plane. |
float | viewHeight | Height of the frustum at the near clipping plane. |
float | nearZ | Distance to the near clipping plane. |
float | farZ | Distance to the far clipping plane. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the perspective projection matrix. |
Plus(XMMatrix)
Performance an identity operation on a matrix.
Declaration
public static XMMatrix Plus(XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the matrix. |
Reflect(XMVector)
Builds a transformation matrix designed to reflect vectors through a given plane.
Declaration
public static XMMatrix Reflect(XMVector reflectionPlane)
Parameters
Type | Name | Description |
---|---|---|
XMVector | reflectionPlane | Plane to reflect through. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the transformation matrix. |
RotationAxis(XMVector, float)
Builds a matrix that rotates around an arbitrary axis.
Declaration
public static XMMatrix RotationAxis(XMVector axis, float angle)
Parameters
Type | Name | Description |
---|---|---|
XMVector | axis | Vector describing the axis of rotation. |
float | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationNormal(XMVector, float)
Builds a matrix that rotates around an arbitrary normal vector.
Declaration
public static XMMatrix RotationNormal(XMVector normalAxis, float angle)
Parameters
Type | Name | Description |
---|---|---|
XMVector | normalAxis | Normal vector describing the axis of rotation. |
float | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationQuaternion(XMVector)
Builds a rotation matrix from a quaternion.
Declaration
public static XMMatrix RotationQuaternion(XMVector quaternion)
Parameters
Type | Name | Description |
---|---|---|
XMVector | quaternion | Quaternion defining the rotation. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationRollPitchYaw(float, float, float)
Builds a rotation matrix based on a given pitch, yaw, and roll (Euler angles).
Declaration
public static XMMatrix RotationRollPitchYaw(float pitch, float yaw, float roll)
Parameters
Type | Name | Description |
---|---|---|
float | pitch | Angle of rotation around the x-axis, in radians. |
float | yaw | Angle of rotation around the y-axis, in radians. |
float | roll | Angle of rotation around the z-axis, in radians. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationRollPitchYawFromVector(XMVector)
Builds a rotation matrix based on a vector containing the Euler angles (pitch, yaw, and roll).
Declaration
public static XMMatrix RotationRollPitchYawFromVector(XMVector angles)
Parameters
Type | Name | Description |
---|---|---|
XMVector | angles | 3D vector containing the Euler angles in the order pitch, then yaw, and then roll. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationX(float)
Builds a matrix that rotates around the x-axis.
Declaration
public static XMMatrix RotationX(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | Angle of rotation around the x-axis, in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationY(float)
Builds a matrix that rotates around the y-axis.
Declaration
public static XMMatrix RotationY(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | Angle of rotation around the y-axis, in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
RotationZ(float)
Builds a matrix that rotates around the z-axis.
Declaration
public static XMMatrix RotationZ(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | Angle of rotation around the z-axis, in radians. Angles are measured clockwise when looking along the rotation axis toward the origin. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the rotation matrix. |
Scaling(float, float, float)
Builds a matrix that scales along the x-axis, y-axis, and z-axis.
Declaration
public static XMMatrix Scaling(float scaleX, float scaleY, float scaleZ)
Parameters
Type | Name | Description |
---|---|---|
float | scaleX | Scaling factor along the x-axis. |
float | scaleY | Scaling factor along the y-axis. |
float | scaleZ | Scaling factor along the z-axis. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the scaling matrix. |
ScalingFromVector(XMVector)
Builds a scaling matrix from a 3D vector.
Declaration
public static XMMatrix ScalingFromVector(XMVector scale)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scale | 3D vector describing the scaling along the x-axis, y-axis, and z-axis. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the scaling matrix. |
Shadow(XMVector, XMVector)
Builds a transformation matrix that flattens geometry into a plane.
Declaration
public static XMMatrix Shadow(XMVector shadowPlane, XMVector lightPosition)
Parameters
Type | Name | Description |
---|---|---|
XMVector | shadowPlane | Reference plane. |
XMVector | lightPosition | 4D vector describing the light's position. If the light's w-component is 0.0f, the ray from the origin to the light represents a directional light. If it is 1.0f, the light is a point light. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the transformation matrix that flattens the geometry into the plane ShadowPlane. |
StoreFloat3X3(out XMFloat3X3)
Stores an XMMatrix in an XMFloat3X3.
Declaration
public void StoreFloat3X3(out XMFloat3X3 destination)
Parameters
Type | Name | Description |
---|---|---|
XMFloat3X3 | destination | The destination structure |
StoreFloat4X3(out XMFloat4X3)
Stores an XMMatrix in an XMFloat4X3.
Declaration
public void StoreFloat4X3(out XMFloat4X3 destination)
Parameters
Type | Name | Description |
---|---|---|
XMFloat4X3 | destination | The destination structure |
StoreFloat4X4(out XMFloat4X4)
Stores an XMMatrix in an XMFloat4X4.
Declaration
public void StoreFloat4X4(out XMFloat4X4 destination)
Parameters
Type | Name | Description |
---|---|---|
XMFloat4X4 | destination | The destination structure |
Subtract(XMMatrix, XMMatrix)
Computes the difference of two matrices.
Declaration
public static XMMatrix Subtract(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a matrix that is the difference of the two matrices. |
ToArray()
Convert a matrix to an array of float.
Declaration
public float[] ToArray()
Returns
Type | Description |
---|---|
float[] | An array of float. |
ToEuler(XMMatrix)
Computes rotation about y-axis (y), then x-axis (x), then z-axis (z).
Declaration
public static XMVector ToEuler(XMMatrix matrix)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | matrix | A matrix. |
Returns
Type | Description |
---|---|
XMVector | The Euler angles. |
Transformation(XMVector, XMVector, XMVector, XMVector, XMVector, XMVector)
Builds a transformation matrix.
Declaration
public static XMMatrix Transformation(XMVector scalingOrigin, XMVector scalingOrientationQuaternion, XMVector scaling, XMVector rotationOrigin, XMVector rotationQuaternion, XMVector translation)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scalingOrigin | 3D vector describing the center of the scaling. |
XMVector | scalingOrientationQuaternion | Quaternion describing the orientation of the scaling. |
XMVector | scaling | 3D vector containing the scaling factors for the x-axis, y-axis, and z-axis. |
XMVector | rotationOrigin | 3D vector describing the center of the rotation. |
XMVector | rotationQuaternion | Quaternion describing the rotation around the origin indicated by RotationOrigin. |
XMVector | translation | 3D vector describing the translations along the x-axis, y-axis, and z-axis. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the transformation matrix. |
Transformation2D(XMVector, float, XMVector, XMVector, float, XMVector)
Builds a 2D transformation matrix in the xy plane.
Declaration
public static XMMatrix Transformation2D(XMVector scalingOrigin, float scalingOrientation, XMVector scaling, XMVector rotationOrigin, float rotation, XMVector translation)
Parameters
Type | Name | Description |
---|---|---|
XMVector | scalingOrigin | 2D vector describing the center of the scaling. |
float | scalingOrientation | Scaling rotation factor. |
XMVector | scaling | 2D vector containing the scaling factors for the x-axis and y-axis. |
XMVector | rotationOrigin | 2D vector describing the center of the rotation. |
float | rotation | Angle of rotation, in radians. |
XMVector | translation | 2D vector describing the translation. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the transformation matrix. |
Translation(float, float, float)
Builds a translation matrix from the specified offsets.
Declaration
public static XMMatrix Translation(float offsetX, float offsetY, float offsetZ)
Parameters
Type | Name | Description |
---|---|---|
float | offsetX | Translation along the x-axis. |
float | offsetY | Translation along the y-axis. |
float | offsetZ | Translation along the z-axis. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the translation matrix. |
TranslationFromVector(XMVector)
Builds a translation matrix from a vector.
Declaration
public static XMMatrix TranslationFromVector(XMVector offset)
Parameters
Type | Name | Description |
---|---|---|
XMVector | offset | 3D vector describing the translations along the x-axis, y-axis, and z-axis. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the translation matrix. |
Transpose()
Computes the transpose of a matrix.
Declaration
public XMMatrix Transpose()
Returns
Type | Description |
---|---|
XMMatrix | Returns the transpose. |
Operators
| Edit this page View Sourceoperator +(XMMatrix, XMMatrix)
Computes the sum of two matrices.
Declaration
public static XMMatrix operator +(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a matrix that is the sum of the two matrices. |
operator /(XMMatrix, float)
Divide each element of a matrix by a scalar.
Declaration
public static XMMatrix operator /(XMMatrix m, float s)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
float | s | The scalar. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
operator ==(XMMatrix, XMMatrix)
Compares two XMMatrix objects. The result specifies whether the values of the two objects are equal.
Declaration
public static bool operator ==(XMMatrix left, XMMatrix right)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | left | The left XMMatrix to compare. |
XMMatrix | right | The right XMMatrix to compare. |
Returns
Type | Description |
---|---|
bool |
implicit operator float[](XMMatrix)
Convert a matrix to an array of float.
Declaration
public static implicit operator float[](XMMatrix value)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | value | The matrix. |
Returns
Type | Description |
---|---|
float[] | An array of float. |
operator !=(XMMatrix, XMMatrix)
Compares two XMMatrix objects. The result specifies whether the values of the two objects are unequal.
Declaration
public static bool operator !=(XMMatrix left, XMMatrix right)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | left | The left XMMatrix to compare. |
XMMatrix | right | The right XMMatrix to compare. |
Returns
Type | Description |
---|---|
bool |
operator *(XMMatrix, XMMatrix)
Computes the product of two matrices.
Declaration
public static XMMatrix operator *(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the product of M1 and M2. |
operator *(XMMatrix, float)
Multiply each element of a matrix by a scalar.
Declaration
public static XMMatrix operator *(XMMatrix m, float s)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
float | s | The scalar. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
operator *(float, XMMatrix)
Multiply each element of a matrix by a scalar.
Declaration
public static XMMatrix operator *(float s, XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
float | s | The scalar. |
XMMatrix | m | The matrix. |
Returns
Type | Description |
---|---|
XMMatrix | A matrix. |
operator -(XMMatrix, XMMatrix)
Computes the difference of two matrices.
Declaration
public static XMMatrix operator -(XMMatrix m1, XMMatrix m2)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m1 | The first matrix. |
XMMatrix | m2 | The second matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns a matrix that is the difference of the two matrices. |
operator -(XMMatrix)
Computes the negation of a matrix.
Declaration
public static XMMatrix operator -(XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the negation of the matrix. |
operator +(XMMatrix)
Performance an identity operation on a matrix.
Declaration
public static XMMatrix operator +(XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
XMMatrix | m | The matrix. |
Returns
Type | Description |
---|---|
XMMatrix | Returns the matrix. |