9 #include "3esvector3.h" 10 #include "3esvector4.h" 69 Matrix4(
const T &rc00,
const T &rc01,
const T &rc02,
const T &rc03,
70 const T &rc10,
const T &rc11,
const T &rc12,
const T &rc13,
71 const T &rc20,
const T &rc21,
const T &rc22,
const T &rc23,
72 const T &rc30,
const T &rc31,
const T &rc32,
const T &rc33);
81 inline const T &
operator()(
int r,
int c)
const {
return rc[r][c]; }
91 inline const T &
operator[](
int index)
const {
return m[index]; }
194 *
this =
lookAt(eye, target, axisUp, forwardAxisIndex, upAxisIndex);
329 template <
typename T>
334 template <
typename T>
339 template <
typename T>
343 #include "3esmatrix4.inl" 345 #endif // _3ESMATRIX4_H_ Matrix4< T > & initRotationX(const T &angle)
Initialise this matrix as a rotation around the X axis.
Definition: 3esmatrix4.h:101
Matrix4< T > & transpose()
Transposes this matrix.
Matrix4< T > & initScaling(const Vector3< T > &scale)
Initialise this matrix as scaling matrix with no rotation or translation.
Definition: 3esmatrix4.h:166
Vector3< T > axisY() const
Returns the Y axis of this matrix (elements (0, 1), (1, 1), (2, 1)).
Vector3< T > axisZ() const
Returns the Z axis of this matrix (elements (0, 2), (1, 2), (2, 2)).
T & operator()(int r, int c)
Row/column access.
Definition: 3esmatrix4.h:77
Matrix4< T > & setAxisY(const Vector3< T > &axis)
Sets the Y axis of this matrix.
static Matrix4< T > rotationY(const T &angle)
Create a matrix which represents a rotation around the Y axis.
A row major 4x4 transformation matrix.
Definition: 3esmatrix4.h:27
Vector3< T > axis(int index) const
Returns one of the axes of this matrix.
static Matrix4< T > rotationZ(const T &angle)
Create a matrix which represents a rotation around the Z axis.
static Matrix4< T > rotationX(const T &angle)
Create a matrix which represents a rotation around the X axis.
Matrix4< T > initTranslation(const Vector3< T > &trans)
Initialise this matrix as a translation only matrix.
Definition: 3esmatrix4.h:146
Matrix4< T > & rigidBodyInvert()
Inverts this matrix assuming this matrix represents a rigid body transformation.
Definition: 3esbounds.h:13
static const Matrix4< T > identity
The identity matrix.
Definition: 3esmatrix4.h:37
const T & operator()(int r, int c) const
Row/column immutable access.
Definition: 3esmatrix4.h:81
Represents a vector in R4.
Definition: 3esvector4.h:13
T rc[4][4]
Row/column indexing representation.
Definition: 3esmatrix4.h:32
Matrix4< T > & initRotation(const T &x, const T &y, const T &z)
Initialise this matrix as a rotation using the given Euler angles.
Definition: 3esmatrix4.h:136
Matrix4< T > & setAxisX(const Vector3< T > &axis)
Sets the X axis of this matrix.
static Matrix4< T > rotation(const T &x, const T &y, const T &z)
Create a matrix which represents a rotation around each axis (Euler angles).
Matrix4< T > & setAxisT(const Vector3< T > &axis)
Sets the translation of this matrix.
Matrix3< T > operator*(const Matrix3< T > &a, const Matrix3< T > &b)
Performs the matrix multiplication AB.
Matrix4< T > & initRotationTranslation(const T &x, const T &y, const T &z, const Vector3< T > &trans)
Definition: 3esmatrix4.h:156
Vector3< T > axisX() const
Returns the X axis of this matrix (elements (0, 0), (1, 0), (2, 0)).
Vector3< T > translation() const
Returns the T axis or translation component of this matrix (elements (0, 3), (1, 3), (2, 3)).
static Matrix4< T > scaling(const Vector3< T > &scale)
Create a scaling matrix.
Matrix4< T > transposed() const
Returns the transpose of this matrix, leaving this matrix unchanged.
static const Matrix4< T > zero
A matrix with all zero elements.
Definition: 3esmatrix4.h:36
Vector3< T > scale() const
Returns the scale contained in this matrix.
Matrix4< T > & invert()
Inverts this matrix.
Represents a vector in R3.
Definition: 3esvector3.h:14
Vector3< T > axisT() const
Returns the T axis or translation component of this matrix (elements (0, 3), (1, 3), (2, 3)).
Matrix4< T > & setTranslation(const Vector3< T > &axis)
Sets the translation of this matrix.
Matrix4< T > & initRotationY(const T &angle)
Initialise this matrix as a rotation around the Y axis.
Definition: 3esmatrix4.h:111
Matrix4< T > rigidBodyInverse() const
Returns the inverse of this matrix assuming this is a rigid body transformation.
static Matrix4< T > lookAt(const Vector3< T > &eye, const Vector3< T > &target, const Vector3< T > &axisUp, int forwardAxisIndex=1, int upAxisIndex=2)
Create a model or camera matrix at eye looking at target.
Matrix4< float > Matrix4f
Defines a single precision 4x4 matrix.
Definition: 3esmatrix4.h:320
T m[16]
Array representation.
Definition: 3esmatrix4.h:33
static Matrix4< T > rotationTranslation(const T &x, const T &y, const T &z, const Vector3< T > &trans)
Create a transformation matrix with rotation (Euler angles) and translation.
Matrix4< T > & initLookAt(const Vector3< T > &eye, const Vector3< T > &target, const Vector3< T > &axisUp, int forwardAxisIndex=1, int upAxisIndex=2)
Initialise this matrix as a model or camera matrix.
Definition: 3esmatrix4.h:192
Matrix4< T > & initRotationZ(const T &angle)
Initialise this matrix as a rotation around the Z axis.
Definition: 3esmatrix4.h:121
Matrix4< T > & setAxisZ(const Vector3< T > &axis)
Sets the Z axis of this matrix.
Vector3< T > removeScale()
Removes scale from the matrix, leaving a rotation/translation matrix.
Matrix4()
Empty constructor; contents are undefined.
Definition: 3esmatrix4.h:40
Matrix4< T > inverse() const
Returns the inverse of this matrix, leaving this matrix unchanged.
const T & operator[](int index) const
Indexing operator (no bounds checking).
Definition: 3esmatrix4.h:91
Matrix4< double > Matrix4d
Defines a double precision 4x4 matrix.
Definition: 3esmatrix4.h:322
T determinant() const
Calculates the determinant of this matrix.
Vector3< T > transform(const Vector3< T > &v) const
Transforms the vector v by this matrix.
T & operator[](int index)
Indexing operator (no bounds checking).
Definition: 3esmatrix4.h:86
Vector3< T > rotate(const Vector3< T > &v) const
Transforms the vector v by the rotation component of this matrix.
Matrix4< T > & setAxis(int index, const Vector3< T > &axis)
Sets the indexed axis of this matrix.