This topic has not yet been rated - Rate this topic

# Matrix Structure

Defines a matrix.

Namespace:  Microsoft.Xna.Framework
Assembly:  Microsoft.Xna.Framework.Math (in Microsoft.Xna.Framework.Math.dll)
```public struct Matrix
```

The Matrix type exposes the following members.

NameDescription
MatrixInitializes a new instance of Matrix.
Top
NameDescription
BackwardGets and sets the backward vector of the Matrix.
DownGets and sets the down vector of the Matrix.
ForwardGets and sets the forward vector of the Matrix.
IdentityReturns an instance of the identity matrix.
LeftGets and sets the left vector of the Matrix.
RightGets and sets the right vector of the Matrix.
TranslationGets and sets the translation vector of the Matrix.
UpGets and sets the up vector of the Matrix.
Top
NameDescription
CreateBillboard(Vector3, Vector3, Vector3, Nullable<Vector3>)Creates a spherical billboard that rotates around a specified object position.
CreateBillboard(Vector3, Vector3, Vector3, Nullable<Vector3>, Matrix)Creates a spherical billboard that rotates around a specified object position.
CreateConstrainedBillboard(Vector3, Vector3, Vector3, Nullable<Vector3>, Nullable<Vector3>)Creates a cylindrical billboard that rotates around a specified axis.
CreateConstrainedBillboard(Vector3, Vector3, Vector3, Nullable<Vector3>, Nullable<Vector3>, Matrix)Creates a cylindrical billboard that rotates around a specified axis.
CreateFromAxisAngle(Vector3, Single)Creates a new Matrix that rotates around an arbitrary vector.
CreateFromAxisAngle(Vector3, Single, Matrix)Creates a new Matrix that rotates around an arbitrary vector.
CreateFromQuaternion(Quaternion)Creates a rotation Matrix from a Quaternion.
CreateFromQuaternion(Quaternion, Matrix)Creates a rotation Matrix from a Quaternion.
CreateFromYawPitchRoll(Single, Single, Single)Creates a new rotation matrix from a specified yaw, pitch, and roll.
CreateFromYawPitchRoll(Single, Single, Single, Matrix)Fills in a rotation matrix from a specified yaw, pitch, and roll.
CreateLookAt(Vector3, Vector3, Vector3)Creates a view matrix.
CreateLookAt(Vector3, Vector3, Vector3, Matrix)Creates a view matrix.
CreateOrthographic(Single, Single, Single, Single)Builds an orthogonal projection matrix.
CreateOrthographic(Single, Single, Single, Single, Matrix)Builds an orthogonal projection matrix.
CreateOrthographicOffCenter(Single, Single, Single, Single, Single, Single)Builds a customized, orthogonal projection matrix.
CreateOrthographicOffCenter(Single, Single, Single, Single, Single, Single, Matrix)Builds a customized, orthogonal projection matrix.
CreatePerspective(Single, Single, Single, Single)Builds a perspective projection matrix and returns the result by value.
CreatePerspective(Single, Single, Single, Single, Matrix)Builds a perspective projection matrix and returns the result by reference.
CreatePerspectiveFieldOfView(Single, Single, Single, Single)Builds a perspective projection matrix based on a field of view and returns by value.
CreatePerspectiveFieldOfView(Single, Single, Single, Single, Matrix)Builds a perspective projection matrix based on a field of view and returns by reference.
CreatePerspectiveOffCenter(Single, Single, Single, Single, Single, Single)Builds a customized, perspective projection matrix.
CreatePerspectiveOffCenter(Single, Single, Single, Single, Single, Single, Matrix)Builds a customized, perspective projection matrix.
CreateReflection(Plane)Creates a Matrix that reflects the coordinate system about a specified Plane.
CreateReflection(Plane, Matrix)Fills in an existing Matrix so that it reflects the coordinate system about a specified Plane.
CreateRotationX(Single)Returns a matrix that can be used to rotate a set of vertices around the x-axis.
CreateRotationX(Single, Matrix)Populates data into a user-specified matrix that can be used to rotate a set of vertices around the x-axis.
CreateRotationY(Single)Returns a matrix that can be used to rotate a set of vertices around the y-axis.
CreateRotationY(Single, Matrix)Populates data into a user-specified matrix that can be used to rotate a set of vertices around the y-axis.
CreateRotationZ(Single)Returns a matrix that can be used to rotate a set of vertices around the z-axis.
CreateRotationZ(Single, Matrix)Populates data into a user-specified matrix that can be used to rotate a set of vertices around the z-axis.
CreateScale(Single)Creates a scaling Matrix.
CreateScale(Vector3)Creates a scaling Matrix.
CreateScale(Single, Matrix)Creates a scaling Matrix.
CreateScale(Vector3, Matrix)Creates a scaling Matrix.
CreateScale(Single, Single, Single)Creates a scaling Matrix.
CreateScale(Single, Single, Single, Matrix)Creates a scaling Matrix.
CreateShadow(Vector3, Plane)Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
CreateShadow(Vector3, Plane, Matrix)Fills in a Matrix to flatten geometry into a specified Plane as if casting a shadow from a specified light source.
CreateTranslation(Vector3)Creates a translation Matrix.
CreateTranslation(Vector3, Matrix)Creates a translation Matrix.
CreateTranslation(Single, Single, Single)Creates a translation Matrix.
CreateTranslation(Single, Single, Single, Matrix)Creates a translation Matrix.
CreateWorld(Vector3, Vector3, Vector3)Creates a world matrix with the specified parameters.
CreateWorld(Vector3, Vector3, Vector3, Matrix)Creates a world matrix with the specified parameters.
DecomposeExtracts the scalar, translation, and rotation components from a 3D scale/rotate/translate (SRT) Matrix.
DeterminantCalculates the determinant of the matrix.
Divide(Matrix, Matrix)Divides the components of a matrix by the corresponding components of another matrix.
Divide(Matrix, Single)Divides the components of a matrix by a scalar.
Divide(Matrix, Matrix, Matrix)Divides the components of a matrix by the corresponding components of another matrix.
Divide(Matrix, Single, Matrix)Divides the components of a matrix by a scalar.
Equals(Object)Returns a value that indicates whether the current instance is equal to a specified object. (Overrides ValueType.Equals(Object).)
Equals(Matrix)Determines whether the specified Object is equal to the Matrix.
GetHashCodeGets the hash code of this object. (Overrides ValueType.GetHashCode().)
Invert(Matrix)Calculates the inverse of a matrix.
Invert(Matrix, Matrix)Calculates the inverse of a matrix.
Lerp(Matrix, Matrix, Single)Linearly interpolates between the corresponding values of two matrices.
Lerp(Matrix, Matrix, Single, Matrix)Linearly interpolates between the corresponding values of two matrices.
Multiply(Matrix, Matrix)Multiplies a matrix by another matrix.
Multiply(Matrix, Single)Multiplies a matrix by a scalar value.
Multiply(Matrix, Matrix, Matrix)Multiplies a matrix by another matrix.
Multiply(Matrix, Single, Matrix)Multiplies a matrix by a scalar value.
Negate(Matrix)Negates individual elements of a matrix.
Negate(Matrix, Matrix)Negates individual elements of a matrix.
Subtract(Matrix, Matrix)Subtracts matrices.
Subtract(Matrix, Matrix, Matrix)Subtracts matrices.
ToStringRetrieves a string representation of the current object. (Overrides ValueType.ToString().)
Transform(Matrix, Quaternion)Transforms a Matrix by applying a Quaternion rotation.
Transform(Matrix, Quaternion, Matrix)Transforms a Matrix by applying a Quaternion rotation.
Transpose(Matrix)Transposes the rows and columns of a matrix.
Transpose(Matrix, Matrix)Transposes the rows and columns of a matrix.
Top
NameDescription
Division(Matrix, Matrix)Divides the components of a matrix by the corresponding components of another matrix.
Division(Matrix, Single)Divides the components of a matrix by a scalar.
EqualityCompares a matrix for equality with another matrix.
InequalityTests a matrix for inequality with another matrix.
Multiply(Single, Matrix)Multiplies a matrix by a scalar value.
Multiply(Matrix, Matrix)Multiplies a matrix by another matrix.
Multiply(Matrix, Single)Multiplies a matrix by a scalar value.
SubtractionSubtracts matrices.
UnaryNegationNegates individual elements of a matrix.
Top
NameDescription
M11Value at row 1 column 1 of the matrix.
M12Value at row 1 column 2 of the matrix.
M13Value at row 1 column 3 of the matrix.
M14Value at row 1 column 4 of the matrix.
M21Value at row 2 column 1 of the matrix.
M22Value at row 2 column 2 of the matrix.
M23Value at row 2 column 3 of the matrix.
M24Value at row 2 column 4 of the matrix.
M31Value at row 3 column 1 of the matrix.
M32Value at row 3 column 2 of the matrix.
M33Value at row 3 column 3 of the matrix.
M34Value at row 3 column 4 of the matrix.
M41Value at row 4 column 1 of the matrix.
M42Value at row 4 column 2 of the matrix.
M43Value at row 4 column 3 of the matrix.
M44Value at row 4 column 4 of the matrix.
Top

Matrices use a row vector layout in the XNA Framework. Matrices can be either row vector or column vector. Row vector matrices view vectors as a row from left to right, while column vector matrices view vectors as a column from top to bottom. For example, the x, y, and z of a matrix's translation vector in the XNA Framework would correspond to the fields M41, M42, M43.

#### Silverlight

Supported in: 5

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.