|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Public Attributes
gameplay::Matrix Class Reference

`#include <Matrix.h>`

List of all members.

## Public Member Functions

| 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)
| Matrix (const float *m)
| Matrix (const Matrix &copy)
| ~Matrix ()
void | add (float scalar)
void | add (float scalar, Matrix *dst)
void | add (const Matrix &m)
bool | decompose (Vector3 *scale, Quaternion *rotation, Vector3 *translation) const
float | determinant () const
void | getScale (Vector3 *scale) const
bool | getRotation (Quaternion *rotation) const
void | getTranslation (Vector3 *translation) const
void | getUpVector (Vector3 *dst) const
void | getDownVector (Vector3 *dst) const
void | getLeftVector (Vector3 *dst) const
void | getRightVector (Vector3 *dst) const
void | getForwardVector (Vector3 *dst) const
void | getBackVector (Vector3 *dst) const
bool | invert ()
bool | invert (Matrix *dst) const
bool | isIdentity () const
void | multiply (float scalar)
void | multiply (float scalar, Matrix *dst) const
void | multiply (const Matrix &m)
void | negate ()
void | negate (Matrix *dst) const
void | rotate (const Quaternion &q)
void | rotate (const Quaternion &q, Matrix *dst) const
void | rotate (const Vector3 &axis, float angle)
void | rotate (const Vector3 &axis, float angle, Matrix *dst) const
void | rotateX (float angle)
void | rotateX (float angle, Matrix *dst) const
void | rotateY (float angle)
void | rotateY (float angle, Matrix *dst) const
void | rotateZ (float angle)
void | rotateZ (float angle, Matrix *dst) const
void | scale (float value)
void | scale (float value, Matrix *dst) const
void | scale (float xScale, float yScale, float zScale)
void | scale (float xScale, float yScale, float zScale, Matrix *dst) const
void | scale (const Vector3 &s)
void | scale (const Vector3 &s, Matrix *dst) const
void | set (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)
void | set (const float *m)
void | set (const Matrix &m)
void | setIdentity ()
void | setZero ()
void | subtract (const Matrix &m)
void | transformPoint (Vector3 *point) const
void | transformPoint (const Vector3 &point, Vector3 *dst) const
void | transformVector (Vector3 *vector) const
void | transformVector (const Vector3 &vector, Vector3 *dst) const
void | transformVector (float x, float y, float z, float w, Vector3 *dst) const
void | transformVector (Vector4 *vector) const
void | transformVector (const Vector4 &vector, Vector4 *dst) const
void | translate (float x, float y, float z)
void | translate (float x, float y, float z, Matrix *dst) const
void | translate (const Vector3 &t)
void | translate (const Vector3 &t, Matrix *dst) const
void | transpose ()
void | transpose (Matrix *dst) const
const Matrix | operator+ (const Matrix &m) const
Matrix & | operator+= (const Matrix &m)
const Matrix | operator- (const Matrix &m) const
Matrix & | operator-= (const Matrix &m)
const Matrix | operator- () const
const Matrix | operator* (const Matrix &m) const
Matrix & | operator*= (const Matrix &m)

## Static Public Member Functions

static const Matrix & | identity ()
static const Matrix & | zero ()
static void | createLookAt (const Vector3 &eyePosition, const Vector3 &targetPosition, const Vector3 &up, Matrix *dst)
static void | createLookAt (float eyePositionX, float eyePositionY, float eyePositionZ, float targetCenterX, float targetCenterY, float targetCenterZ, float upX, float upY, float upZ, Matrix *dst)
static void | createPerspective (float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane, Matrix *dst)
static void | createOrthographic (float width, float height, float zNearPlane, float zFarPlane, Matrix *dst)
static void | createOrthographicOffCenter (float left, float right, float bottom, float top, float zNearPlane, float zFarPlane, Matrix *dst)
static void | createBillboard (const Vector3 &objectPosition, const Vector3 &cameraPosition, const Vector3 &cameraUpVector, Matrix *dst)
static void | createBillboard (const Vector3 &objectPosition, const Vector3 &cameraPosition, const Vector3 &cameraUpVector, const Vector3 &cameraForwardVector, Matrix *dst)
static void | createReflection (const Plane &plane, Matrix *dst)
static void | createScale (const Vector3 &scale, Matrix *dst)
static void | createScale (float xScale, float yScale, float zScale, Matrix *dst)
static void | createRotation (const Quaternion &quat, Matrix *dst)
static void | createRotation (const Vector3 &axis, float angle, Matrix *dst)
static void | createRotationX (float angle, Matrix *dst)
static void | createRotationY (float angle, Matrix *dst)
static void | createRotationZ (float angle, Matrix *dst)
static void | createTranslation (const Vector3 &translation, Matrix *dst)
static void | createTranslation (float xTranslation, float yTranslation, float zTranslation, Matrix *dst)
static void | add (const Matrix &m1, const Matrix &m2, Matrix *dst)
static void | multiply (const Matrix &m, float scalar, Matrix *dst)
static void | multiply (const Matrix &m1, const Matrix &m2, Matrix *dst)
static void | subtract (const Matrix &m1, const Matrix &m2, Matrix *dst)

## Public Attributes

float | m [16]

## Detailed Description

Defines a 4 x 4 floating point matrix representing a 3D transformation.

Vectors are treated as columns, resulting in a matrix that is represented as follows, where x, y and z are the translation components of the matrix:

1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1

This matrix class is directly compatible with OpenGL since its elements are laid out in memory exactly as they are expected by OpenGL. The matrix uses column-major format such that array indices increase down column first. Since matrix multiplication is not commutative, multiplication must be done in the correct order when combining transformations. Suppose we have a translation matrix T and a rotation matrix R. To first rotate an object around the origin and then translate it, you would multiply the two matrices as TR.

Likewise, to first translate the object and then rotate it, you would do RT. So generally, matrices must be multiplied in the reverse order in which you want the transformations to take place (this also applies to the scale, rotate, and translate methods below; these methods are convenience methods for post-multiplying by a matrix representing a scale, rotation, or translation).

In the case of repeated local transformations (i.e. rotate around the Z-axis by 0.76 radians, then translate by 2.1 along the X-axis, then ...), it is better to use the Transform class (which is optimized for that kind of usage).

See also:
  Transform

## Constructor & Destructor Documentation

gameplay::Matrix::Matrix | ( |  | ) |

Constructs a matrix initialized to the identity matrix:

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

gameplay::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
| ) |  |

Constructs a matrix initialized to the specified value.

Parameters:

  m11 | The first element of the first row.
  m12 | The second element of the first row.
  m13 | The third element of the first row.
  m14 | The fourth element of the first row.
  m21 | The first element of the second row.
  m22 | The second element of the second row.
  m23 | The third element of the second row.
  m24 | The fourth element of the second row.
  m31 | The first element of the third row.
  m32 | The second element of the third row.
  m33 | The third element of the third row.
  m34 | The fourth element of the third row.
  m41 | The first element of the fourth row.
  m42 | The second element of the fourth row.
  m43 | The third element of the fourth row.
  m44 | The fourth element of the fourth row.

gameplay::Matrix::Matrix | ( | const float * | m | ) |

Creates a matrix initialized to the specified column-major array.

The passed-in array is in column-major order, so the memory layout of the array is as follows:

0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15

Parameters:

  m | An array containing 16 elements in column-major order.

gameplay::Matrix::Matrix | ( | const Matrix & | copy | ) |

Constructs a new matrix by copying the values from the specified matrix.

Parameters:

  copy | The matrix to copy.

gameplay::Matrix::~Matrix | ( |  | ) |

Destructor.

## Member Function Documentation

void gameplay::Matrix::add | ( | float | scalar | ) |

Adds a scalar value to each component of this matrix.

Parameters:

  scalar | The scalar to add.

void gameplay::Matrix::add | ( | float | scalar,
|  | Matrix * | dst
| ) |  |

Adds a scalar value to each component of this matrix and stores the result in dst.

Parameters:

  scalar | The scalar value to add.
  dst | A matrix to store the result in.

void gameplay::Matrix::add | ( | const Matrix & | m | ) |

Adds the specified matrix to this matrix.

Parameters:

  m | The matrix to add.

static void gameplay::Matrix::add | ( | const Matrix & | m1,
|  | const Matrix & | m2,
|  | Matrix * | dst
| ) |  | `[static]`

Adds the specified matrices and stores the result in dst.

Parameters:

  m1 | The first matrix.
  m2 | The second matrix.
  dst | The destination matrix to add to.

static void gameplay::Matrix::createBillboard | ( | const Vector3 & | objectPosition,
|  | const Vector3 & | cameraPosition,
|  | const Vector3 & | cameraUpVector,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a spherical billboard that rotates around a specified object position.

This method computes the facing direction of the billboard from the object position and camera position. When the object and camera positions are too close, the matrix will not be accurate. To avoid this problem, this method defaults to the identity rotation if the positions are too close. (See the other overload of createBillboard for an alternative approach).

Parameters:

  objectPosition | The position of the object the billboard will rotate around.
  cameraPosition | The position of the camera.
  cameraUpVector | The up vector of the camera.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createBillboard | ( | const Vector3 & | objectPosition,
|  | const Vector3 & | cameraPosition,
|  | const Vector3 & | cameraUpVector,
|  | const Vector3 & | cameraForwardVector,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a spherical billboard that rotates around a specified object position with provision for a safe default orientation.

This method computes the facing direction of the billboard from the object position and camera position. When the object and camera positions are too close, the matrix will not be accurate. To avoid this problem, this method uses the specified camera forward vector if the positions are too close. (See the other overload of createBillboard for an alternative approach).

Parameters:

  objectPosition | The position of the object the billboard will rotate around.
  cameraPosition | The position of the camera.
  cameraUpVector | The up vector of the camera.
  cameraForwardVector | The forward vector of the camera, used if the positions are too close.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createLookAt | ( | const Vector3 & | eyePosition,
|  | const Vector3 & | targetPosition,
|  | const Vector3 & | up,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a view matrix based on the specified input parameters.

Parameters:

  eyePosition | The eye position.
  targetPosition | The target's center position.
  up | The up vector.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createLookAt | ( | float | eyePositionX,
|  | float | eyePositionY,
|  | float | eyePositionZ,
|  | float | targetCenterX,
|  | float | targetCenterY,
|  | float | targetCenterZ,
|  | float | upX,
|  | float | upY,
|  | float | upZ,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a view matrix based on the specified input parameters.

Parameters:

  eyePositionX | The eye x-coordinate position.
  eyePositionY | The eye y-coordinate position.
  eyePositionZ | The eye z-coordinate position.
  targetCenterX | The target's center x-coordinate position.
  targetCenterY | The target's center y-coordinate position.
  targetCenterZ | The target's center z-coordinate position.
  upX | The up vector x-coordinate value.
  upY | The up vector y-coordinate value.
  upZ | The up vector z-coordinate value.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createOrthographic | ( | float | width,
|  | float | height,
|  | float | zNearPlane,
|  | float | zFarPlane,
|  | Matrix * | dst
| ) |  | `[static]`

Creates an orthographic projection matrix.

Parameters:

  width | The width of the view.
  height | The height of the view.
  zNearPlane | The minimum z-value of the view volume.
  zFarPlane | The maximum z-value of the view volume.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createOrthographicOffCenter | ( | float | left,
|  | float | right,
|  | float | bottom,
|  | float | top,
|  | float | zNearPlane,
|  | float | zFarPlane,
|  | Matrix * | dst
| ) |  | `[static]`

Creates an orthographic projection matrix.

Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x and y coordinates ranging from -1 to 1, and z coordinates ranging from 0 to 1.

Unlike perspective projection, in orthographic projection there is no perspective foreshortening.

The viewable area of this orthographic projection extends from left to right on the x-axis, bottom to top on the y-axis, and zNearPlane to zFarPlane on the z-axis. These values are relative to the position and x, y, and z-axes of the view. To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.

Parameters:

  left | The minimum x-value of the view volume.
  right | The maximum x-value of the view volume.
  bottom | The minimum y-value of the view volume.
  top | The maximum y-value of the view volume.
  zNearPlane | The minimum z-value of the view volume.
  zFarPlane | The maximum z-value of the view volume.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createPerspective | ( | float | fieldOfView,
|  | float | aspectRatio,
|  | float | zNearPlane,
|  | float | zFarPlane,
|  | Matrix * | dst
| ) |  | `[static]`

Builds a perspective projection matrix based on a field of view and returns by value.

Projection space refers to the space after applying projection transformation from view space. After the projection transformation, visible content has x- and y-coordinates ranging from -1 to 1, and a z-coordinate ranging from 0 to 1. To obtain the viewable area (in world space) of a scene, create a BoundingFrustum and pass the combined view and projection matrix to the constructor.

Parameters:

  fieldOfView | The field of view in the y direction (in degrees).
  aspectRatio | The aspect ratio, defined as view space width divided by height.
  zNearPlane | The distance to the near view plane.
  zFarPlane | The distance to the far view plane.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createReflection | ( | const Plane & | plane,
|  | Matrix * | dst
| ) |  | `[static]`

Fills in an existing Matrix so that it reflects the coordinate system about a specified Plane.

Parameters:

  plane | The Plane about which to create a reflection.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createRotation | ( | const Quaternion & | quat,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a rotation matrix from the specified quaternion.

Parameters:

  quat | A quaternion describing a 3D orientation.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createRotation | ( | const Vector3 & | axis,
|  | float | angle,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a rotation matrix from the specified axis and angle.

Parameters:

  axis | A vector describing the axis to rotate about.
  angle | The angle (in radians).
  dst | A matrix to store the result in.

static void gameplay::Matrix::createRotationX | ( | float | angle,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a matrix describing a rotation around the x-axis.

Parameters:

  angle | The angle of rotation (in radians).
  dst | A matrix to store the result in.

static void gameplay::Matrix::createRotationY | ( | float | angle,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a matrix describing a rotation around the y-axis.

Parameters:

  angle | The angle of rotation (in radians).
  dst | A matrix to store the result in.

static void gameplay::Matrix::createRotationZ | ( | float | angle,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a matrix describing a rotation around the z-axis.

Parameters:

  angle | The angle of rotation (in radians).
  dst | A matrix to store the result in.

static void gameplay::Matrix::createScale | ( | const Vector3 & | scale,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a scale matrix.

Parameters:

  scale | The amount to scale.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createScale | ( | float | xScale,
|  | float | yScale,
|  | float | zScale,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a scale matrix.

Parameters:

  xScale | The amount to scale along the x-axis.
  yScale | The amount to scale along the y-axis.
  zScale | The amount to scale along the z-axis.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createTranslation | ( | const Vector3 & | translation,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a translation matrix.

Parameters:

  translation | The translation.
  dst | A matrix to store the result in.

static void gameplay::Matrix::createTranslation | ( | float | xTranslation,
|  | float | yTranslation,
|  | float | zTranslation,
|  | Matrix * | dst
| ) |  | `[static]`

Creates a translation matrix.

Parameters:

  xTranslation | The translation on the x-axis.
  yTranslation | The translation on the y-axis.
  zTranslation | The translation on the z-axis.
  dst | A matrix to store the result in.

bool gameplay::Matrix::decompose | ( | Vector3 * | scale,
|  | Quaternion * | rotation,
|  | Vector3 * | translation
| ) |  | const

Decomposes the scale, rotation and translation components of this matrix.

Parameters:

  scale | The scale.
  rotation | The rotation.
  translation | The translation.

float gameplay::Matrix::determinant | ( |  | ) | const

Computes the determinant of this matrix.

Returns:
  The determinant.

void gameplay::Matrix::getBackVector | ( | Vector3 * | dst | ) | const

Gets the backward vector of this matrix.

Parameters:

  dst | The destination vector.

void gameplay::Matrix::getDownVector | ( | Vector3 * | dst | ) | const

Gets the down vector of this matrix.

Parameters:

  dst | The destination vector.

void gameplay::Matrix::getForwardVector | ( | Vector3 * | dst | ) | const

Gets the forward vector of this matrix.

Parameters:

  dst | The destination vector.

void gameplay::Matrix::getLeftVector | ( | Vector3 * | dst | ) | const

Gets the left vector of this matrix.

Parameters:

  dst | The destination vector.

void gameplay::Matrix::getRightVector | ( | Vector3 * | dst | ) | const

Gets the right vector of this matrix.

Parameters:

  dst | The destination vector.

bool gameplay::Matrix::getRotation | ( | Quaternion * | rotation | ) | const

Gets the rotational component of this matrix in the specified quaternion.

Parameters:

  rotation | A quaternion to receive the rotation.

Returns:
  true if the rotation is successfully extracted, false otherwise.

void gameplay::Matrix::getScale | ( | Vector3 * | scale | ) | const

Gets the scalar component of this matrix in the specified vector.

If the scalar component of this matrix has negative parts, it is not possible to always extract the exact scalar component; instead, a scale vector that is mathematically equivalent to the original scale vector is extracted and returned.

Parameters:

  scale | A vector to receive the scale.

void gameplay::Matrix::getTranslation | ( | Vector3 * | translation | ) | const

Gets the translational component of this matrix in the specified vector.

Parameters:

  translation | A vector to receive the translation.

void gameplay::Matrix::getUpVector | ( | Vector3 * | dst | ) | const

Gets the up vector of this matrix.

Parameters:

  dst | The destination vector.

static const Matrix& gameplay::Matrix::identity | ( |  | ) | `[static]`

Returns the identity matrix:

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

Returns:
  The identity matrix.

bool gameplay::Matrix::invert | ( |  | ) |

Inverts this matrix.

Returns:
  true if the the matrix can be inverted, false otherwise.

bool gameplay::Matrix::invert | ( | Matrix * | dst | ) | const

Stores the inverse of this matrix in the specified matrix.

Parameters:

  dst | A matrix to store the invert of this matrix in.

Returns:
  true if the the matrix can be inverted, false otherwise.

bool gameplay::Matrix::isIdentity | ( |  | ) | const

Determines if this matrix is equal to the identity matrix.

Returns:
  true if the matrix is an identity matrix, false otherwise.

void gameplay::Matrix::multiply | ( | float | scalar | ) |

Multiplies the components of this matrix by the specified scalar.

Parameters:

  scalar | The scalar value.

void gameplay::Matrix::multiply | ( | float | scalar,
|  | Matrix * | dst
| ) |  | const

Multiplies the components of this matrix by a scalar and stores the result in dst.

Parameters:

  scalar | The scalar value.
  dst | A matrix to store the result in.

static void gameplay::Matrix::multiply | ( | const Matrix & | m,
|  | float | scalar,
|  | Matrix * | dst
| ) |  | `[static]`

Multiplies the components of the specified matrix by a scalar and stores the result in dst.

Parameters:

  m | The matrix.
  scalar | The scalar value.
  dst | A matrix to store the result in.

void gameplay::Matrix::multiply | ( | const Matrix & | m | ) |

Multiplies this matrix by the specified one.

Parameters:

  m | The matrix to multiply.

static void gameplay::Matrix::multiply | ( | const Matrix & | m1,
|  | const Matrix & | m2,
|  | Matrix * | dst
| ) |  | `[static]`

Multiplies m1 by m2 and stores the result in dst.

Parameters:

  m1 | The first matrix to multiply.
  m2 | The second matrix to multiply.
  dst | A matrix to store the result in.

void gameplay::Matrix::negate | ( |  | ) |

Negates this matrix.

void gameplay::Matrix::negate | ( | Matrix * | dst | ) | const

Negates this matrix and stores the result in dst.

Parameters:

  dst | A matrix to store the result in.

const Matrix gameplay::Matrix::operator* | ( | const Matrix & | m | ) | const`[inline]`

Calculates the matrix product of this matrix with the given matrix.

Note: this does not modify this matrix.

Parameters:

  m | The matrix to multiply by.

Returns:
  The matrix product.

Matrix& gameplay::Matrix::operator*= | ( | const Matrix & | m | ) | `[inline]`

Right-multiplies this matrix by the given matrix.

Parameters:

  m | The matrix to multiply by.

Returns:
  This matrix, after the multiplication occurs.

const Matrix gameplay::Matrix::operator+ | ( | const Matrix & | m | ) | const`[inline]`

Calculates the sum of this matrix with the given matrix.

Note: this does not modify this matrix.

Parameters:

  m | The matrix to add.

Returns:
  The matrix sum.

Matrix& gameplay::Matrix::operator+= | ( | const Matrix & | m | ) | `[inline]`

Adds the given matrix to this matrix.

Parameters:

  m | The matrix to add.

Returns:
  This matrix, after the addition occurs.

const Matrix gameplay::Matrix::operator- | ( | const Matrix & | m | ) | const`[inline]`

Calculates the difference of this matrix with the given matrix.

Note: this does not modify this matrix.

Parameters:

  m | The matrix to subtract.

Returns:
  The matrix difference.

const Matrix gameplay::Matrix::operator- | ( |  | ) | const`[inline]`

Calculates the negation of this matrix.

Note: this does not modify this matrix.

Returns:
  The negation of this matrix.

Matrix& gameplay::Matrix::operator-= | ( | const Matrix & | m | ) | `[inline]`

Subtracts the given matrix from this matrix.

Parameters:

  m | The matrix to subtract.

Returns:
  This matrix, after the subtraction occurs.

void gameplay::Matrix::rotate | ( | const Quaternion & | q | ) |

Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation.

Parameters:

  q | The quaternion to rotate by.

void gameplay::Matrix::rotate | ( | const Quaternion & | q,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified quaternion rotation and stores the result in dst.

Parameters:

  q | The quaternion to rotate by.
  dst | A matrix to store the result in.

void gameplay::Matrix::rotate | ( | const Vector3 & | axis,
|  | float | angle
| ) |  |

Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis.

Parameters:

  axis | The axis to rotate about.
  angle | The angle (in radians).

void gameplay::Matrix::rotate | ( | const Vector3 & | axis,
|  | float | angle,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified rotation about the specified axis and stores the result in dst.

Parameters:

  axis | The axis to rotate about.
  angle | The angle (in radians).
  dst | A matrix to store the result in.

void gameplay::Matrix::rotateX | ( | float | angle | ) |

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis.

Parameters:

  angle | The angle (in radians).

void gameplay::Matrix::rotateX | ( | float | angle,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the x-axis and stores the result in dst.

Parameters:

  angle | The angle (in radians).
  dst | A matrix to store the result in.

void gameplay::Matrix::rotateY | ( | float | angle | ) |

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis.

Parameters:

  angle | The angle (in radians).

void gameplay::Matrix::rotateY | ( | float | angle,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the y-axis and stores the result in dst.

Parameters:

  angle | The angle (in radians).
  dst | A matrix to store the result in.

void gameplay::Matrix::rotateZ | ( | float | angle | ) |

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis.

Parameters:

  angle | The angle (in radians).

void gameplay::Matrix::rotateZ | ( | float | angle,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified rotation around the z-axis and stores the result in dst.

Parameters:

  angle | The angle (in radians).
  dst | A matrix to store the result in.

void gameplay::Matrix::scale | ( | float | value | ) |

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.

Parameters:

  value | The amount to scale along all axes.

void gameplay::Matrix::scale | ( | float | value,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.

Parameters:

  value | The amount to scale along all axes.
  dst | A matrix to store the result in.

void gameplay::Matrix::scale | ( | float | xScale,
|  | float | yScale,
|  | float | zScale
| ) |  |

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.

Parameters:

  xScale | The amount to scale along the x-axis.
  yScale | The amount to scale along the y-axis.
  zScale | The amount to scale along the z-axis.

void gameplay::Matrix::scale | ( | float | xScale,
|  | float | yScale,
|  | float | zScale,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.

Parameters:

  xScale | The amount to scale along the x-axis.
  yScale | The amount to scale along the y-axis.
  zScale | The amount to scale along the z-axis.
  dst | A matrix to store the result in.

void gameplay::Matrix::scale | ( | const Vector3 & | s | ) |

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.

Parameters:

  s | The scale values along the x, y and z axes.

void gameplay::Matrix::scale | ( | const Vector3 & | s,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in dst.

Parameters:

  s | The scale values along the x, y and z axes.
  dst | A matrix to store the result in.

void gameplay::Matrix::set | ( | 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
| ) |  |

Sets the values of this matrix.

Parameters:

  m11 | The first element of the first row.
  m12 | The second element of the first row.
  m13 | The third element of the first row.
  m14 | The fourth element of the first row.
  m21 | The first element of the second row.
  m22 | The second element of the second row.
  m23 | The third element of the second row.
  m24 | The fourth element of the second row.
  m31 | The first element of the third row.
  m32 | The second element of the third row.
  m33 | The third element of the third row.
  m34 | The fourth element of the third row.
  m41 | The first element of the fourth row.
  m42 | The second element of the fourth row.
  m43 | The third element of the fourth row.
  m44 | The fourth element of the fourth row.

void gameplay::Matrix::set | ( | const float * | m | ) |

Sets the values of this matrix to those in the specified column-major array.

Parameters:

  m | An array containing 16 elements in column-major format.

void gameplay::Matrix::set | ( | const Matrix & | m | ) |

Sets the values of this matrix to those of the specified matrix.

Parameters:

  m | The source matrix.

void gameplay::Matrix::setIdentity | ( |  | ) |

Sets this matrix to the identity matrix.

void gameplay::Matrix::setZero | ( |  | ) |

Sets all elements of the current matrix to zero.

void gameplay::Matrix::subtract | ( | const Matrix & | m | ) |

Subtracts the specified matrix from the current matrix.

Parameters:

  m | The matrix to subtract.

static void gameplay::Matrix::subtract | ( | const Matrix & | m1,
|  | const Matrix & | m2,
|  | Matrix * | dst
| ) |  | `[static]`

Subtracts the specified matrix from the current matrix.

Parameters:

  m1 | The first matrix.
  m2 | The second matrix.
  dst | A matrix to store the result in.

void gameplay::Matrix::transformPoint | ( | Vector3 * | point | ) | const

Transforms the specified point by this matrix.

The result of the transformation is stored directly into point.

Parameters:

  point | The point to transform and also a vector to hold the result in.

void gameplay::Matrix::transformPoint | ( | const Vector3 & | point,
|  | Vector3 * | dst
| ) |  | const

Transforms the specified point by this matrix, and stores the result in dst.

Parameters:

  point | The point to transform.
  dst | A vector to store the transformed point in.

void gameplay::Matrix::transformVector | ( | Vector3 * | vector | ) | const

Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero.

The result of the transformation is stored directly into vector.

Parameters:

  vector | The vector to transform and also a vector to hold the result in.

void gameplay::Matrix::transformVector | ( | const Vector3 & | vector,
|  | Vector3 * | dst
| ) |  | const

Transforms the specified vector by this matrix by treating the fourth (w) coordinate as zero, and stores the result in dst.

Parameters:

  vector | The vector to transform.
  dst | A vector to store the transformed vector in.

void gameplay::Matrix::transformVector | ( | float | x,
|  | float | y,
|  | float | z,
|  | float | w,
|  | Vector3 * | dst
| ) |  | const

Transforms the specified vector by this matrix.

Parameters:

  x | The vector x-coordinate to transform by.
  y | The vector y-coordinate to transform by.
  z | The vector z-coordinate to transform by.
  w | The vector w-coordinate to transform by.
  dst | A vector to store the transformed point in.

void gameplay::Matrix::transformVector | ( | Vector4 * | vector | ) | const

Transforms the specified vector by this matrix.

The result of the transformation is stored directly into vector.

Parameters:

  vector | The vector to transform.

void gameplay::Matrix::transformVector | ( | const Vector4 & | vector,
|  | Vector4 * | dst
| ) |  | const

Transforms the specified vector by this matrix.

Parameters:

  vector | The vector to transform.
  dst | A vector to store the transformed point in.

void gameplay::Matrix::translate | ( | float | x,
|  | float | y,
|  | float | z
| ) |  |

Post-multiplies this matrix by the matrix corresponding to the specified translation.

Parameters:

  x | The amount to translate along the x-axis.
  y | The amount to translate along the y-axis.
  z | The amount to translate along the z-axis.

void gameplay::Matrix::translate | ( | float | x,
|  | float | y,
|  | float | z,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst.

Parameters:

  x | The amount to translate along the x-axis.
  y | The amount to translate along the y-axis.
  z | The amount to translate along the z-axis.
  dst | A matrix to store the result in.

void gameplay::Matrix::translate | ( | const Vector3 & | t | ) |

Post-multiplies this matrix by the matrix corresponding to the specified translation.

Parameters:

  t | The translation values along the x, y and z axes.

void gameplay::Matrix::translate | ( | const Vector3 & | t,
|  | Matrix * | dst
| ) |  | const

Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in dst.

Parameters:

  t | The translation values along the x, y and z axes.
  dst | A matrix to store the result in.

void gameplay::Matrix::transpose | ( |  | ) |

Transposes this matrix.

void gameplay::Matrix::transpose | ( | Matrix * | dst | ) | const

Transposes this matrix and stores the result in dst.

Parameters:

  dst | A matrix to store the result in.

static const Matrix& gameplay::Matrix::zero | ( |  | ) | `[static]`

Returns the matrix with all zeros.

Returns:
  The matrix with all zeros.

## Member Data Documentation

float gameplay::Matrix::m[16]

Stores the columns of this 4x4 matrix.

All Classes Functions Variables Typedefs Enumerations Enumerator