9 #include "3esvector3.h" 58 Matrix3(
const T &rc00,
const T &rc01,
const T &rc02,
59 const T &rc10,
const T &rc11,
const T &rc12,
60 const T &rc20,
const T &rc21,
const T &rc22);
69 inline const T &
operator()(
int r,
int c)
const {
return rc[r][c]; }
79 inline const T &
operator[](
int index)
const {
return m[index]; }
85 inline Matrix3<T> &initRotationX(
const T &angle) { *
this =
rotationX(angle);
return *
this; }
91 inline Matrix3<T> &initRotationY(
const T &angle) { *
this =
rotationY(angle);
return *
this; }
97 inline Matrix3<T> &initRotationZ(
const T &angle) { *
this =
rotationZ(angle);
return *
this; }
106 inline Matrix3<T> &initRotation(
const T &x,
const T &y,
const T &z) { *
this =
rotation(x, y, z);
return *
this; }
144 *
this =
lookAt(eye, target, axisUp, forwardAxisIndex, upAxisIndex);
254 template <
typename T>
259 template <
typename T>
263 #include "3esmatrix3.inl" 265 #endif // _3ESMATRIX3_H static Matrix3< 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.
static Matrix3< T > rotationX(const T &angle)
Create a matrix which represents a rotation around the X axis.
T & operator()(int r, int c)
Row/column access.
Definition: 3esmatrix3.h:65
Vector3< T > scale() const
Returns the scale contained in this matrix.
Matrix3< T > & transpose()
Transposes this matrix.
static Matrix3< T > scaling(const Vector3< T > &scale)
Create a scaling matrix.
static Matrix3< T > rotationY(const T &angle)
Create a matrix which represents a rotation around the Y axis.
static const Matrix3< T > zero
A matrix with all zero elements.
Definition: 3esmatrix3.h:32
Definition: 3esbounds.h:13
Vector3< T > axis(int index) const
Returns one of the axes of this matrix.
Matrix3< T > & setAxisX(const Vector3< T > &axis)
Sets the X axis of this matrix.
static const Matrix3< T > identity
The identity matrix.
Definition: 3esmatrix3.h:33
Matrix3< T > operator*(const Matrix3< T > &a, const Matrix3< T > &b)
Performs the matrix multiplication AB.
T determinant() const
Calculates the determinant of this matrix.
Vector3< T > axisZ() const
Returns the Z axis of this matrix (elements (0, 2), (1, 2), (2, 2)).
Matrix3()
Empty constructor; contents are undefined.
Definition: 3esmatrix3.h:36
T m[9]
Array representation.
Definition: 3esmatrix3.h:30
Matrix3< T > transposed() const
Returns the transpose of this matrix, leaving this matrix unchanged.
Matrix3< float > Matrix3f
Defines a single precision 4x4 matrix.
Definition: 3esmatrix3.h:245
Represents a vector in R3.
Definition: 3esvector3.h:14
Matrix3< T > & setAxisZ(const Vector3< T > &axis)
Sets the Z axis of this matrix.
Matrix3< T > & setAxis(int index, const Vector3< T > &axis)
Sets the indexed axis of this matrix.
const T & operator[](int index) const
Indexing operator (no bounds checking).
Definition: 3esmatrix3.h:79
Matrix3< T > & invert()
Inverts this matrix.
T rc[3][3]
Row/column indexing representation.
Definition: 3esmatrix3.h:29
Matrix3< T > & setAxisY(const Vector3< T > &axis)
Sets the Y axis of this matrix.
Vector3< T > axisY() const
Returns the Y axis of this matrix (elements (0, 1), (1, 1), (2, 1)).
Vector3< T > axisX() const
Returns the X axis of this matrix (elements (0, 0), (1, 0), (2, 0)).
Matrix3< 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: 3esmatrix3.h:142
const T & operator()(int r, int c) const
Row/column immutable access.
Definition: 3esmatrix3.h:69
static Matrix3< T > rotationZ(const T &angle)
Create a matrix which represents a rotation around the Z axis.
Matrix3< double > Matrix3d
Defines a double precision 4x4 matrix.
Definition: 3esmatrix3.h:247
T getAdjoint(Matrix3< T > &adj) const
Gets the adjoint of this matrix.
static Matrix3< T > rotation(const T &x, const T &y, const T &z)
Create a matrix which represents a rotation around each axis (Euler angles).
Vector3< T > transform(const Vector3< T > &v) const
Transforms the vector v by this matrix.
Vector3< T > rotate(const Vector3< T > &v) const
An alias for transform().
Matrix3< T > inverse() const
Returns the inverse of this matrix, leaving this matrix unchanged.
A row major 3x3 rotation matrix.
Definition: 3esmatrix3.h:24
Matrix3< T > rigidBodyInverse() const
Returns the inverse of this matrix assuming this is a rigid body transformation.
T & operator[](int index)
Indexing operator (no bounds checking).
Definition: 3esmatrix3.h:74
Matrix3< T > & rigidBodyInvert()
Inverts this matrix assuming this matrix represents a rigid body transformation.