# Matrix3DMatrix3DMatrix3DMatrix3D Struct

## Definition

Represents a 4 x 4 matrix used for transformations in 3-D space.

``public value class Matrix3D : IFormattable``
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Matrix3DConverter))]
[System.Serializable]
public struct Matrix3D : IFormattable``````
``````type Matrix3D = struct
interface IFormattable``````
``````Public Structure Matrix3D
Implements IFormattable``````
Inheritance
Matrix3DMatrix3DMatrix3DMatrix3D
Attributes
Implements

## Examples

``````// Multiplies a Vector3D by a Matrix3D using the static Multiply method.
// Returns a Vector3D.

Vector3D vector1 = new Vector3D(20, 30, 40);
Matrix3D matrix1 = new Matrix3D(10, 10, 10, 0, 20, 20, 20, 0, 30, 30, 30, 0, 5, 10, 15, 1);
Vector3D vectorResult = new Vector3D();

vectorResult = Vector3D.Multiply(vector1,matrix1);
// vector Result is equal to (2000, 2000, 2000)
``````
``````' Multiplies a Vector3D by a Matrix3D using the static Multiply method.
' Returns a Vector3D.

Dim vector1 As New Vector3D(20, 30, 40)
Dim matrix1 As New Matrix3D(10, 10, 10, 0, 20, 20, 20, 0, 30, 30, 30, 0, 5, 10, 15, 1)
Dim vectorResult As New Vector3D()

vectorResult = Vector3D.Multiply(vector1,matrix1)
' vector Result is equal to (2000, 2000, 2000)
``````

## Remarks

Matrix3D has the following row-vector syntax:

M11 M12 M13 M14
M21 M22 M23 M24
M31 M32 M33 M34
OffsetX OffsetY OffsetZ M44

Note that because the fourth column is also accessible, the matrix allows developers to represent affine as well as non-affine transforms.

Matrices can be appended or prepended to other matrices. Appending matrix A to matrix B denotes a transformation by B and then by A:

### XAML Attribute Usage

``````<object property="m11, m12, m13, m21, m22, m23, m31, m32, m33, offsetX, offsetY, offsetZ"/>
- or -
<object property="Identity"/>
``````

### XAML Values

The value in the first row and first column of this Matrix3D. For more information, see the M11 property.

The value in the first row and second column of this Matrix3D. For more information, see the M12 property.

The value in the first row and third column of this Matrix3D. For more information, see the M13 property.

The value in the first row and fourth column of this Matrix3D. For more information, see the M14 property.

The value in the second row and first column of this Matrix3D. For more information, see the M21 property.

The value in the second row and second column of this Matrix3D. For more information, see the M22 property.

The value in the second row and third column of this Matrix3D. For more information, see the M23 property.

The value in the second row and fourth column of this Matrix3D. For more information, see the M24 property.

The value in the third row and first column of this Matrix3D. For more information, see the M31 property.

The value in the third row and second column of this Matrix3D. For more information, see the M32 property.

The value in the third row and third column of this Matrix3D. For more information, see the M34 property.

The value in the third row and fourth column of this Matrix3D. For more information, see the M33 property.

The value in the fourth row and fourth column of this Matrix3D. For more information, see the M44 property.

offsetX
System.Double

The value in the fourth row and first column of this Matrix3D. For more information, see the OffsetX property.

offsetY
System.Double

The value in the fourth row and second column of this Matrix3D. For more information, see the OffsetY property.

offsetZ
System.Double

The value in the fourth row and third column of this Matrix3D. For more information, see the OffsetZ property.

## Properties

 Determinant Determinant Determinant Determinant Retrieves the determinant of this Matrix3D structure. HasInverse HasInverse HasInverse HasInverse Gets a value that indicates whether this Matrix3D is invertible. Identity Identity Identity Identity Changes a Matrix3D structure into an identity Matrix3D. IsAffine IsAffine IsAffine IsAffine Gets a value that indicates whether this Matrix3D structure is affine. IsIdentity IsIdentity IsIdentity IsIdentity Determines whether this Matrix3D structure is an identity Matrix3D. M11 M11 M11 M11 Gets or sets the value of the first row and first column of this Matrix3D structure. M12 M12 M12 M12 Gets or sets the value of the first row and second column of this Matrix3D structure. M13 M13 M13 M13 Gets or sets the value of the first row and third column of this Matrix3D structure. M14 M14 M14 M14 Gets or sets the value of the first row and fourth column of this Matrix3D structure. M21 M21 M21 M21 Gets or sets the value of the second row and first column of this Matrix3D structure. M22 M22 M22 M22 Gets or sets the value of the second row and second column of this Matrix3D structure. M23 M23 M23 M23 Gets or sets the value of the second row and third column of this Matrix3D structure. M24 M24 M24 M24 Gets or sets the value of the second row and fourth column of this Matrix3D structure. M31 M31 M31 M31 Gets or sets the value of the third row and first column of this Matrix3D structure. M32 M32 M32 M32 Gets or sets the value of the third row and second column of this Matrix3D structure. M33 M33 M33 M33 Gets or sets the value of the third row and third column of this Matrix3D structure. M34 M34 M34 M34 Gets or sets the value of the third row and fourth column of this Matrix3D structure. M44 M44 M44 M44 Gets or sets the value of the fourth row and fourth column of this Matrix3D structure. OffsetX OffsetX OffsetX OffsetX Gets or sets the value of the fourth row and first column of this Matrix3D structure. OffsetY OffsetY OffsetY OffsetY Gets or sets the value of the fourth row and second column of this Matrix3D structure. OffsetZ OffsetZ OffsetZ OffsetZ Gets or sets the value of the fourth row and third column of this Matrix3D structure.

## Methods

 Append(Matrix3D) Append(Matrix3D) Append(Matrix3D) Append(Matrix3D) Appends a specified matrix to the current matrix. Equals(Object) Equals(Object) Equals(Object) Equals(Object) Tests equality between two matrices. Equals(Matrix3D) Equals(Matrix3D) Equals(Matrix3D) Equals(Matrix3D) Tests equality between two matrices. Equals(Matrix3D, Matrix3D) Equals(Matrix3D, Matrix3D) Equals(Matrix3D, Matrix3D) Equals(Matrix3D, Matrix3D) Tests equality between two matrices. GetHashCode() GetHashCode() GetHashCode() GetHashCode() Returns the hash code for this matrix Invert() Invert() Invert() Invert() Inverts this Matrix3D structure. Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiplies the specified matrices. Parse(String) Parse(String) Parse(String) Parse(String) Converts a string representation of a Matrix3D structure into the equivalent Matrix3D structure. Prepend(Matrix3D) Prepend(Matrix3D) Prepend(Matrix3D) Prepend(Matrix3D) Prepends a specified matrix to the current matrix. Rotate(Quaternion) Rotate(Quaternion) Rotate(Quaternion) Rotate(Quaternion) Appends a rotation transform to the current Matrix3D. RotateAt(Quaternion, Point3D) RotateAt(Quaternion, Point3D) RotateAt(Quaternion, Point3D) RotateAt(Quaternion, Point3D) Rotates this Matrix3D about the specified Point3D. RotateAtPrepend(Quaternion, Point3D) RotateAtPrepend(Quaternion, Point3D) RotateAtPrepend(Quaternion, Point3D) RotateAtPrepend(Quaternion, Point3D) Prepends a rotation about a specified center Point3D to this Matrix3D structure. RotatePrepend(Quaternion) RotatePrepend(Quaternion) RotatePrepend(Quaternion) RotatePrepend(Quaternion) Prepends a rotation specified by a Quaternion to this Matrix3D structure. Scale(Vector3D) Scale(Vector3D) Scale(Vector3D) Scale(Vector3D) Appends the specified scale Vector3D to this Matrix3D structure. ScaleAt(Vector3D, Point3D) ScaleAt(Vector3D, Point3D) ScaleAt(Vector3D, Point3D) ScaleAt(Vector3D, Point3D) Scales this Matrix3D structure by the specified Vector3D about the specified Point3D. ScaleAtPrepend(Vector3D, Point3D) ScaleAtPrepend(Vector3D, Point3D) ScaleAtPrepend(Vector3D, Point3D) ScaleAtPrepend(Vector3D, Point3D) Prepends the specified scale transformation about the specified Point3D to this Matrix3D structure. ScalePrepend(Vector3D) ScalePrepend(Vector3D) ScalePrepend(Vector3D) ScalePrepend(Vector3D) Prepends the specified scale Vector3D to the current Matrix3D structure. SetIdentity() SetIdentity() SetIdentity() SetIdentity() Changes this Matrix3D structure into an identity matrix. ToString() ToString() ToString() ToString() Creates a string representation of this Matrix3D structure. ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) Creates a string representation of this Matrix3D structure. Transform(Point3D) Transform(Point3D) Transform(Point3D) Transform(Point3D) Transforms the specified Point3D by the Matrix3D and returns the result. Transform(Point3D[]) Transform(Point3D[]) Transform(Point3D[]) Transform(Point3D[]) Transforms the specified Point3D objects in the array by the Matrix3D. Transform(Point4D) Transform(Point4D) Transform(Point4D) Transform(Point4D) Transforms the specified Point4D by the Matrix3D and returns the result. Transform(Point4D[]) Transform(Point4D[]) Transform(Point4D[]) Transform(Point4D[]) Transforms the specified Point4D objects in the array by the Matrix3D and returns the result. Transform(Vector3D) Transform(Vector3D) Transform(Vector3D) Transform(Vector3D) Transforms the specified Vector3D by this Matrix3D. Transform(Vector3D[]) Transform(Vector3D[]) Transform(Vector3D[]) Transform(Vector3D[]) Transforms the specified Vector3D objects in the array by this Matrix3D. Translate(Vector3D) Translate(Vector3D) Translate(Vector3D) Translate(Vector3D) Appends a translation of the specified offset to the current Matrix3D structure. TranslatePrepend(Vector3D) TranslatePrepend(Vector3D) TranslatePrepend(Vector3D) TranslatePrepend(Vector3D) Prepends a translation of the specified offset to this Matrix3D structure.

## Operators

 Equality(Matrix3D, Matrix3D) Equality(Matrix3D, Matrix3D) Equality(Matrix3D, Matrix3D) Equality(Matrix3D, Matrix3D) Compares two Matrix3D instances for exact equality. Inequality(Matrix3D, Matrix3D) Inequality(Matrix3D, Matrix3D) Inequality(Matrix3D, Matrix3D) Inequality(Matrix3D, Matrix3D) Compares two Matrix3D instances for exact inequality. Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiply(Matrix3D, Matrix3D) Multiplies the specified matrices.

## Explicit Interface Implementations

 IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) Formats the value of the current instance using the specified format.