Microsoft.Xna.Framework
Class Matrix

java.lang.Object
  extended by System.ValueType
      extended by Microsoft.Xna.Framework.Matrix
All Implemented Interfaces:
IEquatable<Matrix>

public final class Matrix
extends ValueType
implements IEquatable<Matrix>

Defines a matrix.

Author:
Halofreak1990

Field Summary
static Matrix Identity
          Returns an instance of the identity matrix.
 float M11
          Value at row 1 column 1 of the matrix.
 float M12
          Value at row 1 column 2 of the matrix.
 float M13
          Value at row 1 column 3 of the matrix.
 float M14
          Value at row 1 column 4 of the matrix.
 float M21
          Value at row 2 column 1 of the matrix.
 float M22
          Value at row 2 column 2 of the matrix.
 float M23
          Value at row 2 column 3 of the matrix.
 float M24
          Value at row 2 column 4 of the matrix.
 float M31
          Value at row 3 column 1 of the matrix.
 float M32
          Value at row 3 column 2 of the matrix.
 float M33
          Value at row 3 column 3 of the matrix.
 float M34
          Value at row 3 column 4 of the matrix.
 float M41
          Value at row 4 column 1 of the matrix.
 float M42
          Value at row 4 column 2 of the matrix.
 float M43
          Value at row 4 column 3 of the matrix.
 float M44
          Value at row 4 column 4 of the matrix.
 
Constructor Summary
Matrix()
          Initializes a new instance of Matrix.
Matrix(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)
          Initializes a new instance of Matrix.
 
Method Summary
 void Add(Matrix other)
          Adds the current matrix to another matrix.
static Matrix Add(Matrix matrix1, Matrix matrix2)
          Adds a matrix to another matrix.
static void Add(Matrix matrix1, Matrix matrix2, Matrix result)
          Adds a matrix to another matrix.
static Matrix CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
          Creates a spherical billboard that rotates around a specified object position.
static void CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector, Matrix result)
          Creates a spherical billboard that rotates around a specified object position.
static Matrix CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3 cameraForwardVector, Vector3 objectForwardVector)
          Creates a cylindrical billboard that rotates around a specified axis.
static void CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 rotateAxis, Vector3 cameraForwardVector, Vector3 objectForwardVector, Matrix result)
          Creates a cylindrical billboard that rotates around a specified axis.
static Matrix CreateFromAxisAngle(Vector3 axis, float angle)
          Creates a new Matrix that rotates around an arbitrary vector.
static void CreateFromAxisAngle(Vector3 axis, float angle, Matrix result)
          Creates a new Matrix that rotates around an arbitrary vector.
static Matrix CreateFromQuaternion(Quaternion quaternion)
          Creates a rotation Matrix from a Quaternion.
static void CreateFromQuaternion(Quaternion quaternion, Matrix result)
          Creates a rotation Matrix from a Quaternion.
static Matrix CreateFromYawPitchRoll(float yaw, float pitch, float roll)
          Creates a new rotation matrix from a specified yaw, pitch, and roll.
static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, Matrix result)
          Creates a new rotation matrix from a specified yaw, pitch, and roll.
static Matrix CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector)
          Creates a view matrix.
static void CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector, Matrix result)
          Creates a view matrix.
static Matrix CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane)
          Builds an orthogonal projection matrix.
static void CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane, Matrix result)
          Builds an orthogonal projection matrix.
static Matrix CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane)
          Builds a customized, orthogonal projection matrix.
static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane, Matrix result)
          Builds a customized, orthogonal projection matrix.
static Matrix CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance)
          Builds a perspective projection matrix and returns the result by value.
static void CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance, Matrix result)
          Builds a perspective projection matrix and returns the result by reference.
static Matrix CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
          Builds a perspective projection matrix based on a field of view and returns by value.
static void CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, Matrix result)
          Builds a perspective projection matrix based on a field of view and returns by reference.
static Matrix CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance)
          Builds a customized, perspective projection matrix.
static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, Matrix result)
          Builds a customized, perspective projection matrix.
static Matrix CreateReflection(Plane value)
          Creates a Matrix that reflects the coordinate system about a specified Plane.
static void CreateReflection(Plane value, Matrix result)
          Creates a Matrix that reflects the coordinate system about a specified Plane.
static Matrix CreateRotationX(float radians)
          Returns a matrix that can be used to rotate a set of vertices around the x-axis.
static void CreateRotationX(float radians, Matrix result)
          Populates data into a user-specified matrix that can be used to rotate a set of vertices around the x-axis.
static Matrix CreateRotationY(float radians)
          Returns a matrix that can be used to rotate a set of vertices around the y-axis.
static void CreateRotationY(float radians, Matrix result)
          Populates data into a user-specified matrix that can be used to rotate a set of vertices around the y-axis.
static Matrix CreateRotationZ(float radians)
          Returns a matrix that can be used to rotate a set of vertices around the z-axis.
static void CreateRotationZ(float radians, Matrix result)
          Populates data into a user-specified matrix that can be used to rotate a set of vertices around the z-axis.
static Matrix CreateScale(float scale)
          Creates a scaling Matrix.
static Matrix CreateScale(float xScale, float yScale, float zScale)
          Creates a scaling Matrix.
static void CreateScale(float xScale, float yScale, float zScale, Matrix result)
          Creates a scaling Matrix.
static void CreateScale(float scale, Matrix result)
          Creates a scaling Matrix.
static Matrix CreateScale(Vector3 scales)
          Creates a scaling Matrix.
static void CreateScale(Vector3 scales, Matrix result)
          Creates a scaling Matrix.
static Matrix CreateShadow(Vector3 lightDirection, Plane plane)
          Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.
static void CreateShadow(Vector3 lightDirection, Plane plane, Matrix result)
          Fills in a Matrix to flatten geometry into a specified Plane as if casting a shadow from a specified light source.
static Matrix CreateTranslation(float xPosition, float yPosition, float zPosition)
          Creates a translation Matrix.
static void CreateTranslation(float xPosition, float yPosition, float zPosition, Matrix result)
          Creates a translation Matrix.
static Matrix CreateTranslation(Vector3 position)
          Creates a translation Matrix.
static void CreateTranslation(Vector3 position, Matrix result)
          Creates a translation Matrix.
static Matrix CreateWorld(Vector3 position, Vector3 forward, Vector3 up)
          Creates a world matrix with the specified parameters.
static void CreateWorld(Vector3 position, Vector3 forward, Vector3 up, Matrix result)
          Creates a world matrix with the specified parameters.
 float Determinant()
          Calculates the determinant of the matrix.
 void Divide(float divider)
          Divides the components of the current matrix by a scalar.
 void Divide(Matrix other)
          Divides the components of the current matrix by the corresponding components of another matrix.
static Matrix Divide(Matrix matrix1, float divider)
          Divides the components of a matrix by a scalar.
static void Divide(Matrix matrix1, float divider, Matrix result)
          Divides the components of a matrix by a scalar.
static Matrix Divide(Matrix matrix1, Matrix matrix2)
          Divides the components of a matrix by the corresponding components of another matrix.
static void Divide(Matrix matrix1, Matrix matrix2, Matrix result)
          Divides the components of a matrix by the corresponding components of another matrix.
 boolean Equals(Matrix other)
          Determines whether the specified Object is equal to the Matrix.
 boolean equals(java.lang.Object obj)
          Returns a value that indicates whether the current instance is equal to a specified object.
 Vector3 getBackward()
          Gets the backward vector of the Matrix.
 Vector3 getDown()
          Gets the down vector of the Matrix.
 Vector3 getForward()
          Gets the forward vector of the Matrix.
 Vector3 getRight()
          Gets the right vector of the Matrix.
 Vector3 getTranslation()
          Gets the translation vector of the Matrix.
 Vector3 getUp()
          Gets the up vector of this Matrix.
 int hashCode()
          Gets the hash code of this object.
static Matrix Invert(Matrix matrix)
          Calculates the inverse of a matrix.
static void Invert(Matrix matrix, Matrix result)
          Calculates the inverse of a matrix.
 Vector3 Left()
          Gets the left vector of the Matrix.
 void Left(Vector3 value)
          Sets the left vector of the Matrix.
static Matrix Lerp(Matrix matrix1, Matrix matrix2, float amount)
          Linearly interpolates between the corresponding values of two matrices.
static void Lerp(Matrix matrix1, Matrix matrix2, float amount, Matrix result)
          Linearly interpolates between the corresponding values of two matrices.
 void Multiply(float scaleFactor)
          Multiplies the current matrix by a scalar value.
 void Multiply(Matrix other)
          Multiplies the current matrix by another matrix.
static Matrix Multiply(Matrix matrix1, float scaleFactor)
          Multiplies a matrix by a scalar value.
static void Multiply(Matrix matrix1, float scaleFactor, Matrix result)
          Multiplies a matrix by a scalar value.
static Matrix Multiply(Matrix matrix1, Matrix matrix2)
          Multiplies a matrix by another matrix.
static void Multiply(Matrix matrix1, Matrix matrix2, Matrix result)
          Multiplies a matrix by another matrix.
 void Negate()
          Negates individual elements of the current matrix.
static Matrix Negate(Matrix matrix)
          Negates individual elements of a matrix.
static void Negate(Matrix matrix, Matrix result)
          Negates individual elements of a matrix.
 void setBackward(Vector3 value)
          Sets the backward vector of the Matrix.
 void setDown(Vector3 value)
          Sets the down vector of the Matrix.
 void setForward(Vector3 value)
          Sets the forward vector of the Matrix.
 void setRight(Vector3 value)
          Sets the right vector of the Matrix.
 void setTranslation(Vector3 value)
          Sets the translation vector of the Matrix.
 void setUp(Vector3 value)
          Sets the up vector of this Matrix.
 void Subtract(Matrix other)
          Subtracts the specified matrix from the current matrix.
static Matrix Subtract(Matrix matrix1, Matrix matrix2)
          Subtracts matrices.
static void Subtract(Matrix matrix1, Matrix matrix2, Matrix result)
          Subtracts matrices.
 java.lang.String toString()
          Retrieves a string representation of the current object.
static Matrix Transform(Matrix value, Quaternion rotation)
          Transforms a Matrix by applying a Quaternion rotation.
static void Transform(Matrix value, Quaternion rotation, Matrix result)
          Transforms a Matrix by applying a Quaternion rotation.
static Matrix Transpose(Matrix matrix)
          Transposes the rows and columns of a matrix.
static void Transpose(Matrix matrix, Matrix result)
          Transposes the rows and columns of a matrix.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

Identity

public static final Matrix Identity
Returns an instance of the identity matrix.


M11

public float M11
Value at row 1 column 1 of the matrix.


M12

public float M12
Value at row 1 column 2 of the matrix.


M13

public float M13
Value at row 1 column 3 of the matrix.


M14

public float M14
Value at row 1 column 4 of the matrix.


M21

public float M21
Value at row 2 column 1 of the matrix.


M22

public float M22
Value at row 2 column 2 of the matrix.


M23

public float M23
Value at row 2 column 3 of the matrix.


M24

public float M24
Value at row 2 column 4 of the matrix.


M31

public float M31
Value at row 3 column 1 of the matrix.


M32

public float M32
Value at row 3 column 2 of the matrix.


M33

public float M33
Value at row 3 column 3 of the matrix.


M34

public float M34
Value at row 3 column 4 of the matrix.


M41

public float M41
Value at row 4 column 1 of the matrix.


M42

public float M42
Value at row 4 column 2 of the matrix.


M43

public float M43
Value at row 4 column 3 of the matrix.


M44

public float M44
Value at row 4 column 4 of the matrix.

Constructor Detail

Matrix

public Matrix()
Initializes a new instance of Matrix.


Matrix

public Matrix(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)
Initializes a new instance of Matrix.

Parameters:
m11 - Value to initialize m11 to.
m12 - Value to initialize m12 to.
m13 - Value to initialize m13 to.
m14 - Value to initialize m14 to.
m21 - Value to initialize m21 to.
m22 - Value to initialize m22 to.
m23 - Value to initialize m23 to.
m24 - Value to initialize m24 to.
m31 - Value to initialize m31 to.
m32 - Value to initialize m32 to.
m33 - Value to initialize m33 to.
m34 - Value to initialize m34 to.
m41 - Value to initialize m41 to.
m42 - Value to initialize m42 to.
m43 - Value to initialize m43 to.
m44 - Value to initialize m44 to.
Method Detail

getBackward

public Vector3 getBackward()
Gets the backward vector of the Matrix.


setBackward

public void setBackward(Vector3 value)
Sets the backward vector of the Matrix.


getDown

public Vector3 getDown()
Gets the down vector of the Matrix.


setDown

public void setDown(Vector3 value)
Sets the down vector of the Matrix.


getForward

public Vector3 getForward()
Gets the forward vector of the Matrix.


setForward

public void setForward(Vector3 value)
Sets the forward vector of the Matrix.


Left

public Vector3 Left()
Gets the left vector of the Matrix.


Left

public void Left(Vector3 value)
Sets the left vector of the Matrix.


getRight

public Vector3 getRight()
Gets the right vector of the Matrix.


setRight

public void setRight(Vector3 value)
Sets the right vector of the Matrix.


getTranslation

public Vector3 getTranslation()
Gets the translation vector of the Matrix.


setTranslation

public void setTranslation(Vector3 value)
Sets the translation vector of the Matrix.


getUp

public Vector3 getUp()
Gets the up vector of this Matrix.


setUp

public void setUp(Vector3 value)
Sets the up vector of this Matrix.


Add

public void Add(Matrix other)
Adds the current matrix to another matrix.

Parameters:
other - Source matrix.

Add

public static Matrix Add(Matrix matrix1,
                         Matrix matrix2)
Adds a matrix to another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.

Add

public static void Add(Matrix matrix1,
                       Matrix matrix2,
                       Matrix result)
Adds a matrix to another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.
result - [OutAttribute] Resulting matrix.

CreateBillboard

public static Matrix CreateBillboard(Vector3 objectPosition,
                                     Vector3 cameraPosition,
                                     Vector3 cameraUpVector,
                                     Vector3 cameraForwardVector)
Creates a spherical billboard that rotates around a specified object position.

Parameters:
objectPosition - Position of the object the billboard will rotate around.
cameraPosition - Position of the camera.
cameraUpVector - The up vector of the camera.
cameraForwardVector - Optional forward vector of the camera.

CreateBillboard

public static void CreateBillboard(Vector3 objectPosition,
                                   Vector3 cameraPosition,
                                   Vector3 cameraUpVector,
                                   Vector3 cameraForwardVector,
                                   Matrix result)
Creates a spherical billboard that rotates around a specified object position.

Parameters:
objectPosition - Position of the object the billboard will rotate around.
cameraPosition - Position of the camera.
cameraUpVector - The up vector of the camera.
cameraForwardVector - Optional forward vector of the camera.
result - [OutAttribute] The created billboard matrix.

CreateConstrainedBillboard

public static Matrix CreateConstrainedBillboard(Vector3 objectPosition,
                                                Vector3 cameraPosition,
                                                Vector3 rotateAxis,
                                                Vector3 cameraForwardVector,
                                                Vector3 objectForwardVector)
Creates a cylindrical billboard that rotates around a specified axis.

Parameters:
objectPosition - Position of the object the billboard will rotate around.
cameraPosition - Position of the camera.
rotateAxis - Axis to rotate the billboard around.
cameraForwardVector - Optional forward vector of the camera.
objectForwardVector - Optional forward vector of the object.

CreateConstrainedBillboard

public static void CreateConstrainedBillboard(Vector3 objectPosition,
                                              Vector3 cameraPosition,
                                              Vector3 rotateAxis,
                                              Vector3 cameraForwardVector,
                                              Vector3 objectForwardVector,
                                              Matrix result)
Creates a cylindrical billboard that rotates around a specified axis.

Parameters:
objectPosition - Position of the object the billboard will rotate around.
cameraPosition - Position of the camera.
rotateAxis - Axis to rotate the billboard around.
cameraForwardVector - Optional forward vector of the camera.
objectForwardVector - Optional forward vector of the object.
result - [OutAttribute] The created billboard matrix.

CreateFromAxisAngle

public static Matrix CreateFromAxisAngle(Vector3 axis,
                                         float angle)
Creates a new Matrix that rotates around an arbitrary vector.

Parameters:
axis - The axis to rotate around.
angle - The angle to rotate around the vector.

CreateFromAxisAngle

public static void CreateFromAxisAngle(Vector3 axis,
                                       float angle,
                                       Matrix result)
Creates a new Matrix that rotates around an arbitrary vector.

Parameters:
axis - The axis to rotate around.
angle - The angle to rotate around the vector.
result - [OutAttribute] The created Matrix.

CreateFromQuaternion

public static Matrix CreateFromQuaternion(Quaternion quaternion)
Creates a rotation Matrix from a Quaternion.

Parameters:
quaternion - Quaternion to create the Matrix from.

CreateFromQuaternion

public static void CreateFromQuaternion(Quaternion quaternion,
                                        Matrix result)
Creates a rotation Matrix from a Quaternion.

Parameters:
quaternion - Quaternion to create the Matrix from.
result - [OutAttribute] The created Matrix.

CreateFromYawPitchRoll

public static Matrix CreateFromYawPitchRoll(float yaw,
                                            float pitch,
                                            float roll)
Creates a new rotation matrix from a specified yaw, pitch, and roll.

Parameters:
yaw - Angle of rotation, in radians, around the y-axis.
pitch - Angle of rotation, in radians, around the x-axis.
roll - Angle of rotation, in radians, around the z-axis.

CreateFromYawPitchRoll

public static void CreateFromYawPitchRoll(float yaw,
                                          float pitch,
                                          float roll,
                                          Matrix result)
Creates a new rotation matrix from a specified yaw, pitch, and roll.

Parameters:
yaw - Angle of rotation, in radians, around the y-axis.
pitch - Angle of rotation, in radians, around the x-axis.
roll - Angle of rotation, in radians, around the z-axis.
result - [OutAttribute] An existing matrix filled in to represent the specified yaw, pitch, and roll.

CreateLookAt

public static Matrix CreateLookAt(Vector3 cameraPosition,
                                  Vector3 cameraTarget,
                                  Vector3 cameraUpVector)
Creates a view matrix.

Parameters:
cameraPosition - The position of the camera.
cameraTarget - The target towards which the camera is pointing.
cameraUpVector - The direction that is "up" from the camera's point of view.

CreateLookAt

public static void CreateLookAt(Vector3 cameraPosition,
                                Vector3 cameraTarget,
                                Vector3 cameraUpVector,
                                Matrix result)
Creates a view matrix.

Parameters:
cameraPosition - The position of the camera.
cameraTarget - The target towards which the camera is pointing.
cameraUpVector - The direction that is "up" from the camera's point of view.
result - [OutAttribute] The created view matrix.

CreateOrthographic

public static Matrix CreateOrthographic(float width,
                                        float height,
                                        float zNearPlane,
                                        float zFarPlane)
Builds an orthogonal projection matrix.

Parameters:
width - Width of the view volume.
height - Height of the view volume.
zNearPlane - Minimum z-value of the view volume.
zFarPlane - Maximum z-value of the view volume.

CreateOrthographic

public static void CreateOrthographic(float width,
                                      float height,
                                      float zNearPlane,
                                      float zFarPlane,
                                      Matrix result)
Builds an orthogonal projection matrix.

Parameters:
width - Width of the view volume.
height - Height of the view volume.
zNearPlane - Minimum z-value of the view volume.
zFarPlane - Maximum z-value of the view volume.
result - [OutAttribute] The projection matrix.

CreateOrthographicOffCenter

public static Matrix CreateOrthographicOffCenter(float left,
                                                 float right,
                                                 float bottom,
                                                 float top,
                                                 float zNearPlane,
                                                 float zFarPlane)
Builds a customized, orthogonal projection matrix.

Parameters:
left - Minimum x-value of the view volume.
right - Maximum x-value of the view volume.
bottom - Minimum y-value of the view volume.
top - Maximum y-value of the view volume.
zNearPlane - Minimum z-value of the view volume.
zFarPlane - Maximum z-value of the view volume.

CreateOrthographicOffCenter

public static void CreateOrthographicOffCenter(float left,
                                               float right,
                                               float bottom,
                                               float top,
                                               float zNearPlane,
                                               float zFarPlane,
                                               Matrix result)
Builds a customized, orthogonal projection matrix.

Parameters:
left - Minimum x-value of the view volume.
right - Maximum x-value of the view volume.
bottom - Minimum y-value of the view volume.
top - Maximum y-value of the view volume.
zNearPlane - Minimum z-value of the view volume.
zFarPlane - Maximum z-value of the view volume.
result - [OutAttribute] The projection matrix.

CreatePerspective

public static Matrix CreatePerspective(float width,
                                       float height,
                                       float nearPlaneDistance,
                                       float farPlaneDistance)
Builds a perspective projection matrix and returns the result by value.

Parameters:
width - Width of the view volume at the near view plane.
height - Height of the view volume at the near view plane.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to the far view plane.

CreatePerspective

public static void CreatePerspective(float width,
                                     float height,
                                     float nearPlaneDistance,
                                     float farPlaneDistance,
                                     Matrix result)
Builds a perspective projection matrix and returns the result by reference.

Parameters:
width - Width of the view volume at the near view plane.
height - Height of the view volume at the near view plane.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to the far view plane.
result - [OutAttribute] The projection matrix.

CreatePerspectiveFieldOfView

public static Matrix CreatePerspectiveFieldOfView(float fieldOfView,
                                                  float aspectRatio,
                                                  float nearPlaneDistance,
                                                  float farPlaneDistance)
Builds a perspective projection matrix based on a field of view and returns by value.

Parameters:
fieldOfView - Field of view in the y direction, in radians.
aspectRatio - Aspect ratio, defined as view space width divided by height. To match the aspect ratio of the viewport, the property AspectRatio.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to the far view plane.

CreatePerspectiveFieldOfView

public static void CreatePerspectiveFieldOfView(float fieldOfView,
                                                float aspectRatio,
                                                float nearPlaneDistance,
                                                float farPlaneDistance,
                                                Matrix result)
Builds a perspective projection matrix based on a field of view and returns by reference.

Parameters:
fieldOfView - Field of view in the y direction, in radians.
aspectRatio - Aspect ratio, defined as view space width divided by height. To match the aspect ratio of the viewport, the property AspectRatio.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to the far view plane.
result - [OutAttribute] The perspective projection matrix.

CreatePerspectiveOffCenter

public static Matrix CreatePerspectiveOffCenter(float left,
                                                float right,
                                                float bottom,
                                                float top,
                                                float nearPlaneDistance,
                                                float farPlaneDistance)
Builds a customized, perspective projection matrix.

Parameters:
left - Minimum x-value of the view volume at the near view plane.
right - Maximum x-value of the view volume at the near view plane.
bottom - Minimum y-value of the view volume at the near view plane.
top - Maximum y-value of the view volume at the near view plane.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to of the far view plane.

CreatePerspectiveOffCenter

public static void CreatePerspectiveOffCenter(float left,
                                              float right,
                                              float bottom,
                                              float top,
                                              float nearPlaneDistance,
                                              float farPlaneDistance,
                                              Matrix result)
Builds a customized, perspective projection matrix.

Parameters:
left - Minimum x-value of the view volume at the near view plane.
right - Maximum x-value of the view volume at the near view plane.
bottom - Minimum y-value of the view volume at the near view plane.
top - Maximum y-value of the view volume at the near view plane.
nearPlaneDistance - Distance to the near view plane.
farPlaneDistance - Distance to of the far view plane.
result - [OutAttribute] The created projection matrix.

CreateReflection

public static Matrix CreateReflection(Plane value)
Creates a Matrix that reflects the coordinate system about a specified Plane.

Parameters:
value - The Plane about which to create a reflection.

CreateReflection

public static void CreateReflection(Plane value,
                                    Matrix result)
Creates a Matrix that reflects the coordinate system about a specified Plane.

Parameters:
value - The Plane about which to create a reflection.
result - [OutAttribute] A Matrix that creates the reflection.

CreateRotationX

public static Matrix CreateRotationX(float radians)
Returns a matrix that can be used to rotate a set of vertices around the x-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the x-axis. Note that you can use ToRadians to convert degrees to radians.

CreateRotationX

public static void CreateRotationX(float radians,
                                   Matrix result)
Populates data into a user-specified matrix that can be used to rotate a set of vertices around the x-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the x-axis. Note that you can use ToRadians to convert degrees to radians.
result - [OutAttribute] The matrix in which to place the calculated data.

CreateRotationY

public static Matrix CreateRotationY(float radians)
Returns a matrix that can be used to rotate a set of vertices around the y-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the y-axis. Note that you can use ToRadians to convert degrees to radians.

CreateRotationY

public static void CreateRotationY(float radians,
                                   Matrix result)
Populates data into a user-specified matrix that can be used to rotate a set of vertices around the y-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the y-axis. Note that you can use ToRadians to convert degrees to radians.
result - [OutAttribute] The matrix in which to place the calculated data.

CreateRotationZ

public static Matrix CreateRotationZ(float radians)
Returns a matrix that can be used to rotate a set of vertices around the z-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the z-axis. Note that you can use ToRadians to convert degrees to radians.

CreateRotationZ

public static void CreateRotationZ(float radians,
                                   Matrix result)
Populates data into a user-specified matrix that can be used to rotate a set of vertices around the z-axis.

Parameters:
radians - The amount, in radians, in which to rotate around the z-axis. Note that you can use ToRadians to convert degrees to radians.
Matrix - [OutAttribute] The rotation matrix.

CreateScale

public static Matrix CreateScale(Vector3 scales)
Creates a scaling Matrix.

Parameters:
scales - Amounts to scale by on the x, y, and z axes.

CreateScale

public static Matrix CreateScale(float scale)
Creates a scaling Matrix.

Parameters:
scale - Amount to scale by.

CreateScale

public static void CreateScale(Vector3 scales,
                               Matrix result)
Creates a scaling Matrix.

Parameters:
scales - Amounts to scale by on the x, y, and z axes.
result - [OutAttribute] The created scaling Matrix.

CreateScale

public static void CreateScale(float scale,
                               Matrix result)
Creates a scaling Matrix.

Parameters:
scale - Value to scale by.
result - [OutAttribute] The created scaling Matrix.

CreateScale

public static Matrix CreateScale(float xScale,
                                 float yScale,
                                 float zScale)
Creates a scaling Matrix.

Parameters:
xScale - Value to scale by on the x-axis.
yScale - Value to scale by on the y-axis.
zScale - Value to scale by on the z-axis.

CreateScale

public static void CreateScale(float xScale,
                               float yScale,
                               float zScale,
                               Matrix result)
Creates a scaling Matrix.

Parameters:
xScale - Value to scale by on the x-axis.
yScale - Value to scale by on the y-axis.
zScale - Value to scale by on the z-axis.
result - [OutAttribute] The created scaling Matrix.

CreateShadow

public static Matrix CreateShadow(Vector3 lightDirection,
                                  Plane plane)
Creates a Matrix that flattens geometry into a specified Plane as if casting a shadow from a specified light source.

Parameters:
lightDirection - A Vector3 specifying the direction from which the light that will cast the shadow is coming.
plane - The Plane onto which the new matrix should flatten geometry so as to cast a shadow.

CreateShadow

public static void CreateShadow(Vector3 lightDirection,
                                Plane plane,
                                Matrix result)
Fills in a Matrix to flatten geometry into a specified Plane as if casting a shadow from a specified light source.

Parameters:
lightDirection - A Vector3 specifying the direction from which the light that will cast the shadow is coming.
plane - The Plane onto which the new matrix should flatten geometry so as to cast a shadow.
result - [OutAttribute] A Matrix that can be used to flatten geometry onto the specified plane from the specified direction.

CreateTranslation

public static Matrix CreateTranslation(Vector3 position)
Creates a translation Matrix.

Parameters:
position - Amounts to translate by on the x, y, and z axes.

CreateTranslation

public static void CreateTranslation(Vector3 position,
                                     Matrix result)
Creates a translation Matrix.

Parameters:
position - Amounts to translate by on the x, y, and z axes.
result - [OutAttribute] The created translation Matrix.

CreateTranslation

public static Matrix CreateTranslation(float xPosition,
                                       float yPosition,
                                       float zPosition)
Creates a translation Matrix.

Parameters:
xPosition - Value to translate by on the x-axis.
yPosition - Value to translate by on the y-axis.
zPosition - Value to translate by on the z-axis.

CreateTranslation

public static void CreateTranslation(float xPosition,
                                     float yPosition,
                                     float zPosition,
                                     Matrix result)
Creates a translation Matrix.

Parameters:
xPosition - Value to translate by on the x-axis.
yPosition - Value to translate by on the y-axis.
zPosition - Value to translate by on the z-axis.
result - [OutAttribute] The created translation Matrix.

CreateWorld

public static Matrix CreateWorld(Vector3 position,
                                 Vector3 forward,
                                 Vector3 up)
Creates a world matrix with the specified parameters.

Parameters:
position - Position of the object. This value is used in translation operations.
forward - Forward direction of the object.
up - Upward direction of the object; usually [0, 1, 0].

CreateWorld

public static void CreateWorld(Vector3 position,
                               Vector3 forward,
                               Vector3 up,
                               Matrix result)
Creates a world matrix with the specified parameters.

Parameters:
position - Position of the object. This value is used in translation operations.
forward - Forward direction of the object.
up - Upward direction of the object; usually [0, 1, 0].
result - [OutAttribute] The created world matrix.

Determinant

public float Determinant()
Calculates the determinant of the matrix.


Divide

public void Divide(Matrix other)
Divides the components of the current matrix by the corresponding components of another matrix.

Parameters:
other - The divisor.

Divide

public static Matrix Divide(Matrix matrix1,
                            Matrix matrix2)
Divides the components of a matrix by the corresponding components of another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - The divisor.

Divide

public void Divide(float divider)
Divides the components of the current matrix by a scalar.

Parameters:
divider - The divisor.

Divide

public static Matrix Divide(Matrix matrix1,
                            float divider)
Divides the components of a matrix by a scalar.

Parameters:
matrix1 - Source matrix.
divider - The divisor.

Divide

public static void Divide(Matrix matrix1,
                          float divider,
                          Matrix result)
Divides the components of a matrix by a scalar.

Parameters:
matrix1 - Source matrix.
divider - The divisor.
result - [OutAttribute] Result of the division.

Divide

public static void Divide(Matrix matrix1,
                          Matrix matrix2,
                          Matrix result)
Divides the components of a matrix by the corresponding components of another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - The divisor.
result - [OutAttribute] Result of the division.

equals

public boolean equals(java.lang.Object obj)
Returns a value that indicates whether the current instance is equal to a specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object with which to make the comparison.
Returns:
true if the current instance is equal to the specified object; false otherwise.

Equals

public boolean Equals(Matrix other)
Determines whether the specified Object is equal to the Matrix.

Specified by:
Equals in interface IEquatable<Matrix>
Parameters:
other - The Object to compare with the current Matrix.
Returns:
true if the current object is equal to the other parameter; otherwise, false.

hashCode

public int hashCode()
Gets the hash code of this object.

Overrides:
hashCode in class java.lang.Object

Invert

public static Matrix Invert(Matrix matrix)
Calculates the inverse of a matrix.

Parameters:
matrix - Source matrix.

Invert

public static void Invert(Matrix matrix,
                          Matrix result)
Calculates the inverse of a matrix.

Parameters:
matrix - The source matrix;
result - [OutAttribute] The inverse of matrix. The same matrix can be used for both arguments.

Lerp

public static Matrix Lerp(Matrix matrix1,
                          Matrix matrix2,
                          float amount)
Linearly interpolates between the corresponding values of two matrices.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.
amount - Interpolation value.

Lerp

public static void Lerp(Matrix matrix1,
                        Matrix matrix2,
                        float amount,
                        Matrix result)
Linearly interpolates between the corresponding values of two matrices.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.
amount - Interpolation value.
result - [OutAttribute] Resulting matrix.

Multiply

public void Multiply(Matrix other)
Multiplies the current matrix by another matrix.

Parameters:
other - Source matrix.

Multiply

public static Matrix Multiply(Matrix matrix1,
                              Matrix matrix2)
Multiplies a matrix by another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.

Multiply

public void Multiply(float scaleFactor)
Multiplies the current matrix by a scalar value.

Parameters:
scaleFactor - Scalar value.

Multiply

public static Matrix Multiply(Matrix matrix1,
                              float scaleFactor)
Multiplies a matrix by a scalar value.

Parameters:
matrix1 - Source matrix.
scaleFactor - Scalar value.

Multiply

public static void Multiply(Matrix matrix1,
                            Matrix matrix2,
                            Matrix result)
Multiplies a matrix by another matrix.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.
result - [OutAttribute] Result of the multiplication.

Multiply

public static void Multiply(Matrix matrix1,
                            float scaleFactor,
                            Matrix result)
Multiplies a matrix by a scalar value.

Parameters:
matrix1 - Source matrix.
scaleFactor - Scalar value.
result - [OutAttribute] The result of the multiplication.

Negate

public void Negate()
Negates individual elements of the current matrix.


Negate

public static Matrix Negate(Matrix matrix)
Negates individual elements of a matrix.

Parameters:
matrix - Source matrix.

Negate

public static void Negate(Matrix matrix,
                          Matrix result)
Negates individual elements of a matrix.

Parameters:
matrix - Source matrix.
result - [OutAttribute] Negated matrix.

Subtract

public void Subtract(Matrix other)
Subtracts the specified matrix from the current matrix.

Parameters:
other - Source matrix.

Subtract

public static Matrix Subtract(Matrix matrix1,
                              Matrix matrix2)
Subtracts matrices.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.

Subtract

public static void Subtract(Matrix matrix1,
                            Matrix matrix2,
                            Matrix result)
Subtracts matrices.

Parameters:
matrix1 - Source matrix.
matrix2 - Source matrix.
result - [OutAttribute] Result of the subtraction.

toString

public java.lang.String toString()
Retrieves a string representation of the current object.

Overrides:
toString in class java.lang.Object
Returns:
String that represents the object.

Transform

public static Matrix Transform(Matrix value,
                               Quaternion rotation)
Transforms a Matrix by applying a Quaternion rotation.

Parameters:
value - The Matrix to transform.
rotation - The rotation to apply, expressed as a Quaternion.

Transform

public static void Transform(Matrix value,
                             Quaternion rotation,
                             Matrix result)
Transforms a Matrix by applying a Quaternion rotation.

Parameters:
value - The Matrix to transform.
rotation - The rotation to apply, expressed as a Quaternion.
result - [OutAttribute] An existing Matrix filled in with the result of the transform.

Transpose

public static Matrix Transpose(Matrix matrix)
Transposes the rows and columns of a matrix.

Parameters:
matrix - Source matrix.

Transpose

public static void Transpose(Matrix matrix,
                             Matrix result)
Transposes the rows and columns of a matrix.

Parameters:
matrix - Source matrix.
result - [OutAttribute] Transposed matrix.