Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::core::CMatrix4< T > Class Template Reference

4x4 matrix. Mostly used as transformation matrix for 3d calculations. More...

`#include <matrix4.h>`

List of all members.

## Public Types
enum | eConstructor { EM4CONST_NOTHING = 0, EM4CONST_COPY, EM4CONST_IDENTITY, EM4CONST_TRANSPOSED, EM4CONST_INVERSE, EM4CONST_INVERSE_TRANSPOSED }
| Constructor Flags. More...
## Public Member Functions
void | buildAxisAlignedBillboard (const core::vector3df &camPos, const core::vector3df &center, const core::vector3df &translation, const core::vector3df &axis, const core::vector3df &from)
| Builds a matrix which rotates a source vector to a look vector over an arbitrary axis.
CMatrix4< T > & | buildCameraLookAtMatrixLH (const vector3df &position, const vector3df &target, const vector3df &upVector)
| Builds a left-handed look-at matrix.
CMatrix4< T > & | buildCameraLookAtMatrixRH (const vector3df &position, const vector3df &target, const vector3df &upVector)
| Builds a right-handed look-at matrix.
CMatrix4< T > & | buildNDCToDCMatrix (const core::rect< s32 > &area, f32 zScale)
| Builds a matrix which transforms a normalized Device Coordinate to Device Coordinates.
CMatrix4< T > & | buildProjectionMatrixOrthoLH (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
| Builds a left-handed orthogonal projection matrix.
CMatrix4< T > & | buildProjectionMatrixOrthoRH (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
| Builds a right-handed orthogonal projection matrix.
CMatrix4< T > & | buildProjectionMatrixPerspectiveFovLH (f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
| Builds a left-handed perspective projection matrix based on a field of view.
CMatrix4< T > & | buildProjectionMatrixPerspectiveFovRH (f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar)
| Builds a right-handed perspective projection matrix based on a field of view.
CMatrix4< T > & | buildProjectionMatrixPerspectiveLH (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
| Builds a left-handed perspective projection matrix.
CMatrix4< T > & | buildProjectionMatrixPerspectiveRH (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar)
| Builds a right-handed perspective projection matrix.
CMatrix4< T > & | buildRotateFromTo (const core::vector3df &from, const core::vector3df &to)
| Builds a matrix that rotates from one vector to another.
CMatrix4< T > & | buildShadowMatrix (const core::vector3df &light, core::plane3df plane, f32 point=1.0f)
| Builds a matrix that flattens geometry into a plane.
CMatrix4< T > & | buildTextureTransform (f32 rotateRad, const core::vector2df &rotatecenter, const core::vector2df &translate, const core::vector2df &scale)
| Set to a texture transformation matrix with the given parameters.
| CMatrix4 (const CMatrix4< T > &other, eConstructor constructor=EM4CONST_COPY)
| Copy constructor.
| CMatrix4 (eConstructor constructor=EM4CONST_IDENTITY)
| Default constructor.
bool | getDefinitelyIdentityMatrix () const
| Gets if the matrix is definitely identity matrix.
bool | getInverse (CMatrix4< T > &out) const
| Gets the inversed matrix of this one.
bool | getInversePrimitive (CMatrix4< T > &out) const
| Inverts a primitive matrix which only contains a translation and a rotation.
core::vector3d< T > | getRotationDegrees () const
| Returns the rotation, as set by setRotation().
core::vector3d< T > | getScale () const
| Get Scale.
vector3d< T > | getTranslation () const
| Gets the current translation.
void | getTransposed (CMatrix4< T > &dest) const
| Gets transposed matrix.
CMatrix4< T > | getTransposed () const
| Gets transposed matrix.
CMatrix4< T > | interpolate (const core::CMatrix4< T > &b, f32 time) const
| Creates a new matrix as interpolated matrix from two other ones.
void | inverseRotateVect (vector3df &vect) const
| Rotate a vector by the inverse of the rotation part of this matrix.
void | inverseTranslateVect (vector3df &vect) const
| Translate a vector by the inverse of the translation part of this matrix.
bool | isIdentity () const
| Returns true if the matrix is the identity matrix.
bool | isIdentity_integer_base () const
| Returns true if the matrix is the identity matrix.
bool | isOrthogonal () const
| Returns true if the matrix is orthogonal.
CMatrix4< T > & | makeIdentity ()
| Set matrix to identity.
bool | makeInverse ()
| Calculates inverse of matrix. Slow.
void | multiplyWith1x4Matrix (T *matrix) const
| Multiplies this matrix by a 1x4 matrix.
bool | operator!= (const CMatrix4< T > &other) const
| Returns true if other matrix is not equal to this matrix.
const T & | operator() (const s32 row, const s32 col) const
| Simple operator for directly accessing every element of the matrix.
T & | operator() (const s32 row, const s32 col)
| Simple operator for directly accessing every element of the matrix.
CMatrix4< T > | operator* (const T &scalar) const
| Multiply by scalar.
CMatrix4< T > | operator* (const CMatrix4< T > &other) const
| Multiply by another matrix.
CMatrix4< T > & | operator*= (const T &scalar)
| Multiply by scalar.
CMatrix4< T > & | operator*= (const CMatrix4< T > &other)
| Multiply by another matrix.
CMatrix4< T > | operator+ (const CMatrix4< T > &other) const
| Add another matrix.
CMatrix4< T > & | operator+= (const CMatrix4< T > &other)
| Add another matrix.
CMatrix4< T > | operator- (const CMatrix4< T > &other) const
| Subtract another matrix.
CMatrix4< T > & | operator-= (const CMatrix4< T > &other)
| Subtract another matrix.
CMatrix4< T > & | operator= (const T &scalar)
| Sets all elements of this matrix to the value.
CMatrix4< T > & | operator= (const CMatrix4< T > &other)
| Sets this matrix equal to the other matrix.
bool | operator== (const CMatrix4< T > &other) const
| Returns true if other matrix is equal to this matrix.
const T & | operator[] (u32 index) const
| Simple operator for linearly accessing every element of the matrix.
T & | operator[] (u32 index)
| Simple operator for linearly accessing every element of the matrix.
T * | pointer ()
const T * | pointer () const
| Returns pointer to internal array.
void | rotateVect (T *out, const core::vector3df &in) const
| An alternate transform vector method, writing into an array of 3 floats.
void | rotateVect (core::vector3df &out, const core::vector3df &in) const
| An alternate transform vector method, writing into a second vector.
void | rotateVect (vector3df &vect) const
| Rotate a vector by the rotation part of this matrix.
CMatrix4< T > & | setbyproduct (const CMatrix4< T > &other_a, const CMatrix4< T > &other_b)
| set this matrix to the product of two matrices
CMatrix4< T > & | setbyproduct_nocheck (const CMatrix4< T > &other_a, const CMatrix4< T > &other_b)
| Set this matrix to the product of two matrices.
void | setDefinitelyIdentityMatrix (bool isDefinitelyIdentityMatrix)
| Sets if the matrix is definitely identity matrix.
CMatrix4< T > & | setInverseRotationDegrees (const vector3d< T > &rotation)
| Make an inverted rotation matrix from Euler angles.
CMatrix4< T > & | setInverseRotationRadians (const vector3d< T > &rotation)
| Make an inverted rotation matrix from Euler angles.
CMatrix4< T > & | setInverseTranslation (const vector3d< T > &translation)
| Set the inverse translation of the current matrix. Will erase any previous values.
CMatrix4< T > & | setM (const T *data)
| Sets all matrix data members at once.
void | setRotationCenter (const core::vector3df &center, const core::vector3df &translate)
| Builds a combined matrix which translates to a center before rotation and translates from origin afterwards.
CMatrix4< T > & | setRotationDegrees (const vector3d< T > &rotation)
| Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
CMatrix4< T > & | setRotationRadians (const vector3d< T > &rotation)
| Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
CMatrix4< T > & | setScale (const T scale)
| Set Scale.
CMatrix4< T > & | setScale (const vector3d< T > &scale)
| Set Scale.
CMatrix4< T > & | setTextureRotationCenter (f32 radAngle)
| Set texture transformation rotation.
CMatrix4< T > & | setTextureScale (f32 sx, f32 sy)
| Set texture transformation scale.
CMatrix4< T > & | setTextureScaleCenter (f32 sx, f32 sy)
| Set texture transformation scale, and recenter at (0.5,0.5).
CMatrix4< T > & | setTextureTranslate (f32 x, f32 y)
| Set texture transformation translation.
CMatrix4< T > & | setTextureTranslateTransposed (f32 x, f32 y)
| Set texture transformation translation, using a transposed representation.
CMatrix4< T > & | setTranslation (const vector3d< T > &translation)
| Set the translation of the current matrix. Will erase any previous values.
void | transformBox (core::aabbox3d< f32 > &box) const
| Transforms a axis aligned bounding box.
void | transformBoxEx (core::aabbox3d< f32 > &box) const
| Transforms a axis aligned bounding box.
void | transformPlane (const core::plane3d< f32 > &in, core::plane3d< f32 > &out) const
| Transforms a plane by this matrix.
void | transformPlane (core::plane3d< f32 > &plane) const
| Transforms a plane by this matrix.
void | transformVect (T *out, const core::vector3df &in) const
| An alternate transform vector method, writing into an array of 4 floats.
void | transformVect (vector3df &out, const vector3df &in) const
| Transforms input vector by this matrix and stores result in output vector.
void | transformVect (vector3df &vect) const
| Transforms the vector by this matrix.
void | translateVect (vector3df &vect) const
| Translate a vector by the translation part of this matrix.

## Detailed Description

### template<class T>
class irr::core::CMatrix4< T >

4x4 matrix. Mostly used as transformation matrix for 3d calculations.

The matrix is a D3D style matrix, row major with translations in the 4th row.

Definition at line 46 of file matrix4.h.

## Member Enumeration Documentation

template<class T>

enum irr::core::CMatrix4::eConstructor

Constructor Flags.

Enumerator:

  EM4CONST_NOTHING |
  EM4CONST_COPY |
  EM4CONST_IDENTITY |
  EM4CONST_TRANSPOSED |
  EM4CONST_INVERSE |
  EM4CONST_INVERSE_TRANSPOSED |

Definition at line 51 of file matrix4.h.

## Constructor & Destructor Documentation

template<class T>

irr::core::CMatrix4< T >::CMatrix4 | ( | eConstructor | constructor = `EM4CONST_IDENTITY` | ) | `[inline]`

Default constructor.

Parameters:

  | constructor | Choose the initialization style

Definition at line 403 of file matrix4.h.

template<class T>

irr::core::CMatrix4< T >::CMatrix4 | ( | const CMatrix4< T > & | other,
|  | eConstructor | constructor = `EM4CONST_COPY` |
| ) |  |  | `[inline]`

Copy constructor.

Parameters:

  | other | Other matrix to copy from
  | constructor | Choose the initialization style

Definition at line 426 of file matrix4.h.

References irr::core::CMatrix4< T >::getInverse(), and irr::core::CMatrix4< T >::getTransposed().

## Member Function Documentation

template<class T>

void irr::core::CMatrix4< T >::buildAxisAlignedBillboard | ( | const core::vector3df & | camPos,
|  | const core::vector3df & | center,
|  | const core::vector3df & | translation,
|  | const core::vector3df & | axis,
|  | const core::vector3df & | from |
| ) |  |  | `[inline]`

Builds a matrix which rotates a source vector to a look vector over an arbitrary axis.

Parameters:

  | camPos,: | viewer position in world coo
  | center,: | object position in world-coo and rotation pivot
  | translation,: | object final translation from center
  | axis,: | axis to rotate about
  | from,: | source vector to rotate from
  | camPos,: | viewer position in world coo
  | center,: | object position in world-coo and rotation pivot
  | translation,: | object final translation from center
  | axis,: | axis to rotate about
  | from,: | source vector to rotate from

Definition at line 1869 of file matrix4.h.

References irr::core::vector3d< T >::crossProduct(), irr::core::vector3d< T >::dotProduct(), irr::core::vector3d< T >::normalize(), irr::core::CMatrix4< T >::setRotationCenter(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildCameraLookAtMatrixLH | ( | const vector3df & | position,
|  | const vector3df & | target,
|  | const vector3df & | upVector |
| ) |  |  | `[inline]`

Builds a left-handed look-at matrix.

Definition at line 1654 of file matrix4.h.

References irr::core::vector3d< T >::crossProduct(), irr::core::vector3d< T >::dotProduct(), irr::core::vector3d< T >::normalize(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildCameraLookAtMatrixRH | ( | const vector3df & | position,
|  | const vector3df & | target,
|  | const vector3df & | upVector |
| ) |  |  | `[inline]`

Builds a right-handed look-at matrix.

Definition at line 1695 of file matrix4.h.

References irr::core::vector3d< T >::crossProduct(), irr::core::vector3d< T >::dotProduct(), irr::core::vector3d< T >::normalize(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildNDCToDCMatrix | ( | const core::rect< s32 > & | area,
|  | f32 | zScale |
| ) |  |  | `[inline]`

Builds a matrix which transforms a normalized Device Coordinate to Device Coordinates.

Used to scale <-1,-1><1,1> to viewport, for example from von <-1,-1> <1,1> to the viewport <0,0><0,640>

Definition at line 1792 of file matrix4.h.

References irr::core::rect< T >::getHeight(), irr::core::rect< T >::getWidth(), irr::core::rect< T >::LowerRightCorner, irr::core::CMatrix4< T >::makeIdentity(), irr::core::CMatrix4< T >::setScale(), and irr::core::rect< T >::UpperLeftCorner.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixOrthoLH | ( | f32 | widthOfViewVolume,
|  | f32 | heightOfViewVolume,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a left-handed orthogonal projection matrix.

Definition at line 1483 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixOrthoRH | ( | f32 | widthOfViewVolume,
|  | f32 | heightOfViewVolume,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a right-handed orthogonal projection matrix.

Definition at line 1518 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveFovLH | ( | f32 | fieldOfViewRadians,
|  | f32 | aspectRatio,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a left-handed perspective projection matrix based on a field of view.

Definition at line 1446 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF, and irr::core::reciprocal().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveFovRH | ( | f32 | fieldOfViewRadians,
|  | f32 | aspectRatio,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a right-handed perspective projection matrix based on a field of view.

Definition at line 1407 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF, and irr::core::reciprocal().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveLH | ( | f32 | widthOfViewVolume,
|  | f32 | heightOfViewVolume,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a left-handed perspective projection matrix.

Definition at line 1588 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildProjectionMatrixPerspectiveRH | ( | f32 | widthOfViewVolume,
|  | f32 | heightOfViewVolume,
|  | f32 | zNear,
|  | f32 | zFar |
| ) |  |  | `[inline]`

Builds a right-handed perspective projection matrix.

Definition at line 1553 of file matrix4.h.

References _IRR_DEBUG_BREAK_IF.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildRotateFromTo | ( | const core::vector3df & | from,
|  | const core::vector3df & | to |
| ) |  |  | `[inline]`

Builds a matrix that rotates from one vector to another.

Parameters:

  | from,: | vector to rotate from
  | to,: | vector to rotate to
  | from,: | vector to rotate from
  | to,: | vector to rotate to

http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm

Definition at line 1813 of file matrix4.h.

References irr::core::vector3d< T >::crossProduct(), irr::core::vector3d< T >::dotProduct(), irr::core::vector3d< T >::normalize(), irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildShadowMatrix | ( | const core::vector3df & | light,
|  | core::plane3df | plane,
|  | f32 | point = `1.0f` |
| ) |  |  | `[inline]`

Builds a matrix that flattens geometry into a plane.

Parameters:

  | light,: | light source
  | plane,: | plane into which the geometry if flattened into
  | point,: | value between 0 and 1, describing the light source. If this is 1, it is a point light, if it is 0, it is a directional light.

Definition at line 1622 of file matrix4.h.

References irr::core::plane3d< T >::D, irr::core::plane3d< T >::Normal, irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::buildTextureTransform | ( | f32 | rotateRad,
|  | const core::vector2df & | rotatecenter,
|  | const core::vector2df & | translate,
|  | const core::vector2df & | scale |
| ) |  |  | `[inline]`

Set to a texture transformation matrix with the given parameters.

Generate texture coordinates as linear functions so that: u = Ux*x + Uy*y + Uz*z + Uw v = Vx*x + Vy*y + Vz*z + Vw The matrix M for this case is: Ux Vx 0 0 Uy Vy 0 0 Uz Vz 0 0 Uw Vw 0 0

Definition at line 1950 of file matrix4.h.

References irr::core::vector2d< T >::X, and irr::core::vector2d< T >::Y.

template<class T>

bool irr::core::CMatrix4< T >::getDefinitelyIdentityMatrix | ( |  | ) | const`[inline]`

Gets if the matrix is definitely identity matrix.

Definition at line 2083 of file matrix4.h.

template<class T>

bool irr::core::CMatrix4< T >::getInverse | ( | CMatrix4< T > & | out | ) | const`[inline]`

Gets the inversed matrix of this one.

Parameters:

  | out,: | where result matrix is written to.

Returns:
  Returns false if there is no inverse matrix.

Calculates the inverse of this Matrix The inverse is calculated using Cramers rule. If no inverse exists then 'false' is returned.

Definition at line 1222 of file matrix4.h.

References irr::core::CMatrix4< T >::isIdentity(), irr::core::iszero(), and irr::core::reciprocal().

Referenced by irr::core::CMatrix4< T >::CMatrix4(), and irr::core::CMatrix4< T >::makeInverse().

template<class T>

bool irr::core::CMatrix4< T >::getInversePrimitive | ( | CMatrix4< T > & | out | ) | const`[inline]`

Inverts a primitive matrix which only contains a translation and a rotation.

Parameters:

  | out,: | where result matrix is written to.

Inverts a primitive matrix which only contains a translation and a rotation

Parameters:

  | out,: | where result matrix is written to.

Definition at line 1308 of file matrix4.h.

References irr::core::CMatrix4< T >::M.

template<class T>

core::vector3d< T > irr::core::CMatrix4< T >::getRotationDegrees | ( |  | ) | const`[inline]`

Returns the rotation, as set by setRotation().

Returns a rotation that is equivalent to that set by setRotationDegrees().

This code was orginally written by by Chev.

This code was sent in by Chev. Note that it does not necessarily return the *same* Euler angles as those set by setRotationDegrees(), but the rotation will be equivalent, i.e. will have the same result when used to rotate a vector or node.

Definition at line 846 of file matrix4.h.

References irr::core::RADTODEG64, and irr::core::ROUNDING_ERROR_f64.

template<class T>

vector3d< T > irr::core::CMatrix4< T >::getScale | ( |  | ) | const`[inline]`

Get Scale.

Returns the absolute values of the scales of the matrix.

Note that this always returns the absolute (positive) values. Unfortunately it does not appear to be possible to extract any original negative values. The best that we could do would be to arbitrarily make one scale negative if one or three of them were negative. FIXME - return the original values.

Definition at line 781 of file matrix4.h.

References irr::core::iszero().

template<class T>

vector3d< T > irr::core::CMatrix4< T >::getTranslation | ( |  | ) | const`[inline]`

Gets the current translation.

Definition at line 730 of file matrix4.h.

Referenced by irr::scene::ISceneNode::getAbsolutePosition().

template<class T>

void irr::core::CMatrix4< T >::getTransposed | ( | CMatrix4< T > & | dest | ) | const`[inline]`

Gets transposed matrix.

Definition at line 1763 of file matrix4.h.

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::getTransposed | ( |  | ) | const`[inline]`

Gets transposed matrix.

Definition at line 1753 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING.

Referenced by irr::core::CMatrix4< T >::CMatrix4().

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::interpolate | ( | const core::CMatrix4< T > & | b,
|  | f32 | time |
| ) |  |  | const`[inline]`

Creates a new matrix as interpolated matrix from two other ones.

Parameters:

  | b,: | other matrix to interpolate with
  | time,: | Must be a value between 0 and 1.

Definition at line 1736 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING, and irr::core::CMatrix4< T >::M.

template<class T>

void irr::core::CMatrix4< T >::inverseRotateVect | ( | vector3df & | vect | ) | const`[inline]`

Rotate a vector by the inverse of the rotation part of this matrix.

Definition at line 1051 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

void irr::core::CMatrix4< T >::inverseTranslateVect | ( | vector3df & | vect | ) | const`[inline]`

Translate a vector by the inverse of the translation part of this matrix.

Definition at line 1205 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

bool irr::core::CMatrix4< T >::isIdentity | ( |  | ) | const`[inline]`

Returns true if the matrix is the identity matrix.

Definition at line 935 of file matrix4.h.

References irr::core::equals(), and irr::core::iszero().

Referenced by irr::core::CMatrix4< T >::getInverse(), irr::core::CMatrix4< T >::operator*(), irr::core::CMatrix4< T >::operator*=(), irr::core::CMatrix4< T >::setbyproduct(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformBoxEx().

template<class T>

bool irr::core::CMatrix4< T >::isIdentity_integer_base | ( |  | ) | const`[inline]`

Returns true if the matrix is the identity matrix.

Definition at line 990 of file matrix4.h.

References F32_VALUE_1, and irr::core::IR().

template<class T>

bool irr::core::CMatrix4< T >::isOrthogonal | ( |  | ) | const`[inline]`

Returns true if the matrix is orthogonal.

Definition at line 961 of file matrix4.h.

References irr::core::iszero().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::makeIdentity | ( |  | ) | `[inline]`

Set matrix to identity.

Definition at line 919 of file matrix4.h.

Referenced by irr::core::CMatrix4< T >::buildNDCToDCMatrix().

template<class T>

bool irr::core::CMatrix4< T >::makeInverse | ( |  | ) | `[inline]`

Calculates inverse of matrix. Slow.

Returns:
  Returns false if there is no inverse matrix.

Definition at line 1339 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING, and irr::core::CMatrix4< T >::getInverse().

template<class T>

void irr::core::CMatrix4< T >::multiplyWith1x4Matrix | ( | T * | matrix | ) | const`[inline]`

Multiplies this matrix by a 1x4 matrix.

Definition at line 1183 of file matrix4.h.

template<class T>

bool irr::core::CMatrix4< T >::operator!= | ( | const CMatrix4< T > & | other | ) | const`[inline]`

Returns true if other matrix is not equal to this matrix.

Definition at line 1399 of file matrix4.h.

template<class T>

const T& irr::core::CMatrix4< T >::operator() | ( | const s32 | row,
|  | const s32 | col |
| ) |  |  | const`[inline]`

Simple operator for directly accessing every element of the matrix.

Definition at line 79 of file matrix4.h.

template<class T>

T& irr::core::CMatrix4< T >::operator() | ( | const s32 | row,
|  | const s32 | col |
| ) |  |  | `[inline]`

Simple operator for directly accessing every element of the matrix.

Definition at line 70 of file matrix4.h.

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::operator* | ( | const T & | scalar | ) | const`[inline]`

Multiply by scalar.

Definition at line 562 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING.

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::operator* | ( | const CMatrix4< T > & | other | ) | const`[inline]`

Multiply by another matrix.

multiply by another matrix

Definition at line 691 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING, and irr::core::CMatrix4< T >::isIdentity().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator*= | ( | const T & | scalar | ) | `[inline]`

Multiply by scalar.

Definition at line 588 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator*= | ( | const CMatrix4< T > & | other | ) | `[inline]`

Multiply by another matrix.

Definition at line 612 of file matrix4.h.

References irr::core::CMatrix4< T >::isIdentity(), and irr::core::CMatrix4< T >::setbyproduct_nocheck().

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::operator+ | ( | const CMatrix4< T > & | other | ) | const`[inline]`

Add another matrix.

Definition at line 462 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator+= | ( | const CMatrix4< T > & | other | ) | `[inline]`

Add another matrix.

Definition at line 488 of file matrix4.h.

template<class T>

CMatrix4< T > irr::core::CMatrix4< T >::operator- | ( | const CMatrix4< T > & | other | ) | const`[inline]`

Subtract another matrix.

Definition at line 512 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_NOTHING.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator-= | ( | const CMatrix4< T > & | other | ) | `[inline]`

Subtract another matrix.

Definition at line 538 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator= | ( | const T & | scalar | ) | `[inline]`

Sets all elements of this matrix to the value.

Definition at line 1371 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::operator= | ( | const CMatrix4< T > & | other | ) | `[inline]`

Sets this matrix equal to the other matrix.

Definition at line 1358 of file matrix4.h.

References irr::core::CMatrix4< T >::M.

template<class T>

bool irr::core::CMatrix4< T >::operator== | ( | const CMatrix4< T > & | other | ) | const`[inline]`

Returns true if other matrix is equal to this matrix.

Definition at line 1384 of file matrix4.h.

References irr::core::CMatrix4< T >::M.

template<class T>

const T& irr::core::CMatrix4< T >::operator[] | ( | u32 | index | ) | const`[inline]`

Simple operator for linearly accessing every element of the matrix.

Definition at line 91 of file matrix4.h.

template<class T>

T& irr::core::CMatrix4< T >::operator[] | ( | u32 | index | ) | `[inline]`

Simple operator for linearly accessing every element of the matrix.

Definition at line 82 of file matrix4.h.

template<class T>

T* irr::core::CMatrix4< T >::pointer | ( |  | ) | `[inline]`

Definition at line 101 of file matrix4.h.

template<class T>

const T* irr::core::CMatrix4< T >::pointer | ( |  | ) | const`[inline]`

Returns pointer to internal array.

Definition at line 100 of file matrix4.h.

Referenced by irr::core::quaternion::getMatrix(), and irr::core::quaternion::getMatrixCenter().

template<class T>

void irr::core::CMatrix4< T >::rotateVect | ( | T * | out,
|  | const core::vector3df & | in |
| ) |  |  | const`[inline]`

An alternate transform vector method, writing into an array of 3 floats.

Definition at line 1043 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

void irr::core::CMatrix4< T >::rotateVect | ( | core::vector3df & | out,
|  | const core::vector3df & | in |
| ) |  |  | const`[inline]`

An alternate transform vector method, writing into a second vector.

Definition at line 1034 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

void irr::core::CMatrix4< T >::rotateVect | ( | vector3df & | vect | ) | const`[inline]`

Rotate a vector by the rotation part of this matrix.

Definition at line 1024 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setbyproduct | ( | const CMatrix4< T > & | other_a,
|  | const CMatrix4< T > & | other_b |
| ) |  |  | `[inline]`

set this matrix to the product of two matrices

multiply by another matrix

Definition at line 674 of file matrix4.h.

References irr::core::CMatrix4< T >::isIdentity(), and irr::core::CMatrix4< T >::setbyproduct_nocheck().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setbyproduct_nocheck | ( | const CMatrix4< T > & | other_a,
|  | const CMatrix4< T > & | other_b |
| ) |  |  | `[inline]`

Set this matrix to the product of two matrices.

multiply by another matrix

no optimization used, use it if you know you never have a identity matrix

Definition at line 639 of file matrix4.h.

References irr::core::CMatrix4< T >::M.

Referenced by irr::core::CMatrix4< T >::operator*=(), and irr::core::CMatrix4< T >::setbyproduct().

template<class T>

void irr::core::CMatrix4< T >::setDefinitelyIdentityMatrix | ( | bool | isDefinitelyIdentityMatrix | ) | `[inline]`

Sets if the matrix is definitely identity matrix.

Definition at line 2073 of file matrix4.h.

Referenced by irr::core::quaternion::getMatrix(), and irr::core::quaternion::getMatrix_transposed().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setInverseRotationDegrees | ( | const vector3d< T > & | rotation | ) | `[inline]`

Make an inverted rotation matrix from Euler angles.

The 4th row and column are unmodified.

Definition at line 805 of file matrix4.h.

References irr::core::DEGTORAD, and irr::core::CMatrix4< T >::setInverseRotationRadians().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setInverseRotationRadians | ( | const vector3d< T > & | rotation | ) | `[inline]`

Make an inverted rotation matrix from Euler angles.

The 4th row and column are unmodified.

Definition at line 886 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::core::CMatrix4< T >::setInverseRotationDegrees().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setInverseTranslation | ( | const vector3d< T > & | translation | ) | `[inline]`

Set the inverse translation of the current matrix. Will erase any previous values.

Definition at line 749 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setM | ( | const T * | data | ) | `[inline]`

Sets all matrix data members at once.

Definition at line 2060 of file matrix4.h.

template<class T>

void irr::core::CMatrix4< T >::setRotationCenter | ( | const core::vector3df & | center,
|  | const core::vector3df & | translate |
| ) |  |  | `[inline]`

Builds a combined matrix which translates to a center before rotation and translates from origin afterwards.

Builds a combined matrix which translate to a center before rotation and translate afterwards.

Parameters:

  | center | Position to rotate around
  | translate | Translation applied after the rotation

Definition at line 1926 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::core::CMatrix4< T >::buildAxisAlignedBillboard(), and irr::core::quaternion::getMatrixCenter().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setRotationDegrees | ( | const vector3d< T > & | rotation | ) | `[inline]`

Make a rotation matrix from Euler angles. The 4th row and column are unmodified.

Definition at line 799 of file matrix4.h.

References irr::core::DEGTORAD, and irr::core::CMatrix4< T >::setRotationRadians().

Referenced by irr::scene::ISceneNode::getRelativeTransformation().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setRotationRadians | ( | const vector3d< T > & | rotation | ) | `[inline]`

Make a rotation matrix from Euler angles. The 4th row and column are unmodified.

Definition at line 811 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::core::CMatrix4< T >::setRotationDegrees().

template<class T>

CMatrix4<T>& irr::core::CMatrix4< T >::setScale | ( | const T | scale | ) | `[inline]`

Set Scale.

Definition at line 190 of file matrix4.h.

References irr::core::CMatrix4< T >::setScale().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setScale | ( | const vector3d< T > & | scale | ) | `[inline]`

Set Scale.

Definition at line 761 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::core::CMatrix4< T >::buildNDCToDCMatrix(), irr::scene::ISceneNode::getRelativeTransformation(), and irr::core::CMatrix4< T >::setScale().

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTextureRotationCenter | ( | f32 | radAngle | ) | `[inline]`

Set texture transformation rotation.

Rotate about z axis, recenter at (0.5,0.5). Doesn't clear other elements than those affected

Parameters:

  | radAngle | Angle in radians

Returns:
  Altered matrix

Definition at line 1986 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTextureScale | ( | f32 | sx,
|  | f32 | sy |
| ) |  |  | `[inline]`

Set texture transformation scale.

Doesn't clear other elements than those affected.

Parameters:

  | sx | Scale factor on x axis
  | sy | Scale factor on y axis

Returns:
  Altered matrix.

Definition at line 2032 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTextureScaleCenter | ( | f32 | sx,
|  | f32 | sy |
| ) |  |  | `[inline]`

Set texture transformation scale, and recenter at (0.5,0.5).

Doesn't clear other elements than those affected.

Parameters:

  | sx | Scale factor on x axis
  | sy | Scale factor on y axis

Returns:
  Altered matrix.

Definition at line 2044 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTextureTranslate | ( | f32 | x,
|  | f32 | y |
| ) |  |  | `[inline]`

Set texture transformation translation.

Doesn't clear other elements than those affected.

Parameters:

  | x | Offset on x axis
  | y | Offset on y axis

Returns:
  Altered matrix

Definition at line 2007 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTextureTranslateTransposed | ( | f32 | x,
|  | f32 | y |
| ) |  |  | `[inline]`

Set texture transformation translation, using a transposed representation.

Doesn't clear other elements than those affected.

Parameters:

  | x | Offset on x axis
  | y | Offset on y axis

Returns:
  Altered matrix

Definition at line 2020 of file matrix4.h.

template<class T>

CMatrix4< T > & irr::core::CMatrix4< T >::setTranslation | ( | const vector3d< T > & | translation | ) | `[inline]`

Set the translation of the current matrix. Will erase any previous values.

Definition at line 737 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::scene::ISceneNode::getRelativeTransformation().

template<class T>

void irr::core::CMatrix4< T >::transformBox | ( | core::aabbox3d< f32 > & | box | ) | const`[inline]`

Transforms a axis aligned bounding box.

The result box of this operation may not be accurate at all. For correct results, use transformBoxEx()

Definition at line 1118 of file matrix4.h.

References irr::core::CMatrix4< T >::isIdentity(), irr::core::aabbox3d< T >::MaxEdge, irr::core::aabbox3d< T >::MinEdge, irr::core::aabbox3d< T >::repair(), and irr::core::CMatrix4< T >::transformVect().

template<class T>

void irr::core::CMatrix4< T >::transformBoxEx | ( | core::aabbox3d< f32 > & | box | ) | const`[inline]`

Transforms a axis aligned bounding box.

Transforms a axis aligned bounding box more accurately than transformBox().

The result box of this operation should by accurate, but this operation is slower than transformBox().

Definition at line 1132 of file matrix4.h.

References irr::core::CMatrix4< T >::isIdentity(), irr::core::aabbox3d< T >::MaxEdge, and irr::core::aabbox3d< T >::MinEdge.

Referenced by irr::scene::ISceneNode::getTransformedBoundingBox().

template<class T>

void irr::core::CMatrix4< T >::transformPlane | ( | const core::plane3d< f32 > & | in,
|  | core::plane3d< f32 > & | out |
| ) |  |  | const`[inline]`

Transforms a plane by this matrix.

Definition at line 1110 of file matrix4.h.

References irr::core::CMatrix4< T >::transformPlane().

template<class T>

void irr::core::CMatrix4< T >::transformPlane | ( | core::plane3d< f32 > & | plane | ) | const`[inline]`

Transforms a plane by this matrix.

Definition at line 1094 of file matrix4.h.

References irr::core::CMatrix4< T >::EM4CONST_INVERSE_TRANSPOSED, irr::core::plane3d< T >::getMemberPoint(), irr::core::plane3d< T >::Normal, irr::core::plane3d< T >::setPlane(), and irr::core::CMatrix4< T >::transformVect().

Referenced by irr::scene::SViewFrustum::transform(), and irr::core::CMatrix4< T >::transformPlane().

template<class T>

void irr::core::CMatrix4< T >::transformVect | ( | T * | out,
|  | const core::vector3df & | in |
| ) |  |  | const`[inline]`

An alternate transform vector method, writing into an array of 4 floats.

Definition at line 1083 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

void irr::core::CMatrix4< T >::transformVect | ( | vector3df & | out,
|  | const vector3df & | in |
| ) |  |  | const`[inline]`

Transforms input vector by this matrix and stores result in output vector.

Definition at line 1074 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

template<class T>

void irr::core::CMatrix4< T >::transformVect | ( | vector3df & | vect | ) | const`[inline]`

Transforms the vector by this matrix.

Definition at line 1060 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

Referenced by irr::scene::SViewFrustum::transform(), irr::core::CMatrix4< T >::transformBox(), and irr::core::CMatrix4< T >::transformPlane().

template<class T>

void irr::core::CMatrix4< T >::translateVect | ( | vector3df & | vect | ) | const`[inline]`

Translate a vector by the translation part of this matrix.

Definition at line 1213 of file matrix4.h.

References irr::core::vector3d< T >::X, irr::core::vector3d< T >::Y, and irr::core::vector3d< T >::Z.

The documentation for this class was generated from the following file:

- matrix4.h

| The Irrlicht Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated on Sun Jan 10 09:24:09 2010 by Doxygen (1.5.6)