This topic has not yet been rated - Rate this topic

Matrix3D Structure

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

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
[SerializableAttribute]
[TypeConverterAttribute(typeof(Matrix3DConverter))]
public struct Matrix3D : IFormattable
<object property="m11, m12, m13, m21, m22, m23, m31, m32, m33, offsetX, offsetY, offsetZ"/>
- or -
<object property="Identity"/>

XAML Values

M11

System.Double

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

M12

System.Double

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

M13

System.Double

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

M14

System.Double

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

M21

System.Double

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

M22

System.Double

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

M23

System.Double

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

M24

System.Double

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

M31

System.Double

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

M32

System.Double

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

M33

System.Double

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

M34

System.Double

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

M44

System.Double

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.

The Matrix3D type exposes the following members.

  Name Description
Public method Matrix3D Constructor that sets matrix's initial values.
Top
  Name Description
Public property Determinant Retrieves the determinant of this Matrix3D structure.
Public property HasInverse Gets a value that indicates whether this Matrix3D is invertible.
Public property Static member Identity Changes a Matrix3D structure into an identity Matrix3D.
Public property IsAffine Gets a value that indicates whether this Matrix3D structure is affine.
Public property IsIdentity Determines whether this Matrix3D structure is an identity Matrix3D.
Public property M11 Gets or sets the value of the first row and first column of this Matrix3D structure.
Public property M12 Gets or sets the value of the first row and second column of this Matrix3D structure.
Public property M13 Gets or sets the value of the first row and third column of this Matrix3D structure.
Public property M14 Gets or sets the value of the first row and fourth column of this Matrix3D structure.
Public property M21 Gets or sets the value of the second row and first column of this Matrix3D structure.
Public property M22 Gets or sets the value of the second row and second column of this Matrix3D structure.
Public property M23 Gets or sets the value of the second row and third column of this Matrix3D structure.
Public property M24 Gets or sets the value of the second row and fourth column of this Matrix3D structure.
Public property M31 Gets or sets the value of the third row and first column of this Matrix3D structure.
Public property M32 Gets or sets the value of the third row and second column of this Matrix3D structure.
Public property M33 Gets or sets the value of the third row and third column of this Matrix3D structure.
Public property M34 Gets or sets the value of the third row and fourth column of this Matrix3D structure.
Public property M44 Gets or sets the value of the fourth row and fourth column of this Matrix3D structure.
Public property OffsetX Gets or sets the value of the fourth row and first column of this Matrix3D structure.
Public property OffsetY Gets or sets the value of the fourth row and second column of this Matrix3D structure.
Public property OffsetZ Gets or sets the value of the fourth row and third column of this Matrix3D structure.
Top
  Name Description
Public method Append Appends a specified matrix to the current matrix.
Public method Equals(Matrix3D) Tests equality between two matrices.
Public method Equals(Object) Tests equality between two matrices. (Overrides ValueType.Equals(Object).)
Public method Static member Equals(Matrix3D, Matrix3D) Tests equality between two matrices.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Returns the hash code for this matrix (Overrides ValueType.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Invert Inverts this Matrix3D structure.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Static member Multiply Multiplies the specified matrices.
Public method Static member Parse Converts a string representation of a Matrix3D structure into the equivalent Matrix3D structure.
Public method Prepend Prepends a specified matrix to the current matrix.
Public method Rotate Appends a rotation transform to the current Matrix3D.
Public method RotateAt Rotates this Matrix3D about the specified Point3D.
Public method RotateAtPrepend Prepends a rotation about a specified center Point3D to this Matrix3D structure.
Public method RotatePrepend Prepends a rotation specified by a Quaternion to this Matrix3D structure.
Public method Scale Appends the specified scale Vector3D to this Matrix3D structure.
Public method ScaleAt Scales this Matrix3D structure by the specified Vector3D about the specified Point3D.
Public method ScaleAtPrepend Prepends the specified scale transformation about the specified Point3D to this Matrix3D structure.
Public method ScalePrepend Prepends the specifed scale Vector3D to the current Matrix3D structure.
Public method SetIdentity Changes this Matrix3D structure into an identity matrix.
Public method ToString() Creates a string representation of this Matrix3D structure. (Overrides ValueType.ToString().)
Public method ToString(IFormatProvider) Creates a string representation of this Matrix3D structure.
Public method Transform(Point3D) Transforms the specified Point3D by the Matrix3D and returns the result.
Public method Transform(Point3D[]) Transforms the specified Point3D objects in the array by the Matrix3D.
Public method Transform(Point4D) Transforms the specified Point4D by the Matrix3D and returns the result..
Public method Transform(Point4D[]) Transforms the specified Point4D objects in the array by the Matrix3D and returns the result.
Public method Transform(Vector3D) Transforms the specified Vector3D by this Matrix3D.
Public method Transform(Vector3D[]) Transforms the specified Vector3D objects in the array by this Matrix3D.
Public method Translate Appends a translation of the specified offset to the current Matrix3D structure.
Public method TranslatePrepend Prepends a translation of the specified offset to this Matrix3D structure.
Top
  Name Description
Public operator Static member Equality Compares two Matrix3D instances for exact equality.
Public operator Static member Inequality Compares two Matrix3D instances for exact inequality.
Public operator Static member Multiply Multiplies the specified matrices.
Top
  Name Description
Explicit interface implemetation Private method IFormattable.ToString Formats the value of the current instance using the specified format.
Top

Matrix3D has the following row-vector syntax:

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:


// 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)


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ