|
|
void | clear () |
| | Fills the matrix with zeroes. |
| |
|
Vector4T< T > | column (int i) const |
| | Returns the ith column vector. |
| |
|
template<class K > |
| void | copy (const K *x) |
| | Fills the matrix by copying values from memory. |
| |
|
template<class K > |
| void | copyTranspose (const K *x) |
| | Fills the matrix by copying transposed values from memory. |
| |
|
T * | data () |
| | Returns a pointer to the first element. |
| |
|
const T * | data () const |
| | Returns a pointer to the first element. |
| |
|
T | get (int r, int c) const |
| | Gets the given matrix element. |
| |
|
void | identity () |
| | Sets the matrix to identity. |
| |
| Matrix4T< T > | inverse (bool *ok=0) const |
| | Returns the inverse of the matrix. More... |
| |
|
void | make (T x11, T x12, T x13, T x14, T x21, T x22, T x23, T x24, T x31, T x32, T x33, T x34, T x41, T x42, T x43, T x44) |
| | Fills the matrix with given values. |
| |
|
template<class K > |
| | Matrix4T (const K *x) |
| | Constructs a matrix and fills it from memory. |
| |
|
| Matrix4T () |
| | Constructs a matrix without initializing it. |
| |
|
| Matrix4T (T x11, T x12, T x13, T x14, T x21, T x22, T x23, T x24, T x31, T x32, T x33, T x34, T x41, T x42, T x43, T x44) |
| | Constructs a matrix and fills it with given values. |
| |
|
| Matrix4T (const Vector4T< T > &a, const Vector4T< T > &b, const Vector4T< T > &c, const Vector4T< T > &d) |
| | Constructs a matrix and initializes it with given row vectors. |
| |
|
bool | operator!= (const Matrix4T< T > &that) const |
| | Compares if two matrices differ. |
| |
|
Matrix4T< T > & | operator*= (const Matrix4T< T > &that) |
| | Multiplies two matrices together. |
| |
|
Matrix4T< T > & | operator*= (T s) |
| | Multiplies the matrix with a scalar. |
| |
|
bool | operator== (const Matrix4T< T > &that) const |
| | Compares if two matrices are equal. |
| |
| Vector4T< T > & | operator[] (int i) |
| | void setDiagonal(const Vector3T<T> &v) { m[0][0] = v[0]; m[1][1] = v[1]; m[2][2] = v[2]; m[3][3] = (T) 1.0; } More... |
| |
| const Vector4T< T > & | operator[] (int i) const |
| | Returns the ith row. More... |
| |
| Matrix4T< T > | orthoNormalize () const |
| | Returns an orthonormalized version of this matrix. More... |
| |
| Vector3T< T > | project (const Vector4T< T > &v) const |
| | Apply the matrix on a 4D vector. More... |
| |
| Vector3T< T > | project (const Vector3T< T > &v) const |
| | Apply the matrix on a 3D vector. More... |
| |
| Vector2T< T > | project (const Vector2T< T > &v) const |
| | Apply the matrix on a 2D vector which is interpreted as [x y 0 1]. More... |
| |
|
Matrix3T< T > | rotation () const |
| | Returns the upper-left 3x3 matrix. |
| |
|
Vector4T< T > & | row (int i) |
| | Returns the ith row. |
| |
|
const Vector4T< T > & | row (int i) const |
| | Returns the ith row. |
| |
|
void | scalingMatrix (const Vector3T< T > &) |
| | Sets the matrix to a scaling matrix. |
| |
|
void | setColumn (int i, const Vector4T< T > &v) |
| | Sets the ith column vector. |
| |
|
void | setDiagonal (const Vector4T< T > &v) |
| | Sets the diagonal to given vector. |
| |
|
void | setRotation (const Nimble::Matrix3T< T > &that) |
| | Replaces the upper-left 3x3 matrix. |
| |
|
void | setTranslation (const Vector3T< T > &v) |
| | Sets the translation part of a 4x4 transformation matrix. |
| |
|
Vector3T< T > | translation () const |
| | Returns the translation part of a 4x4 matrix. |
| |
|
Matrix4T< T > & | transpose () |
| | Transposes the matrix. |
| |
|
void | transpose (Matrix4T< T > &ret) const |
| | Make a transpose of a matrix to a given matrix. |
| |
|
Matrix4T< T > | transposed () const |
| | Returns a transposed matrix. |
| |
|
Matrix3T< T > | upperLeft () const |
| | Get the 3x3 upper-left matrix. |
| |
|
Matrix2T< T > | upperLeft2 () const |
| | Get the 2x2 upper-left matrix. |
| |
|
|
static int | columns () |
| | Returns the number of columns (4) |
| |
| static Matrix4T< T > | makeRotation (T radians, const Vector3T< T > &axis) |
| | Create a rotation matrix. More... |
| |
| static Matrix4T< T > | makeScale (const Vector3T< T > &v) |
| | Create a non-uniform scaling matrix. More... |
| |
|
static Matrix4T< T > | makeTranslation (const Vector2T< T > &v) |
| |
| static Matrix4T< T > | makeTranslation (const Vector3T< T > &v) |
| | Create a translation matrix. More... |
| |
| static Matrix4T< T > | makeTranslation (T x, T y, T z) |
| | Create a translation matrix. More... |
| |
| static Matrix4T< T > | makeUniformScale (const T &s) |
| | Create a uniform scaling matrix. More... |
| |
| static Matrix4T< T > | ortho3D (T left, T right, T bottom, T top, T nearPlane, T farPlane) |
| | Creates an orthogonal projection matrix in 3D This function works in a way similar to glOrtho (http://lmb.informatik.uni-freiburg.de/people/reisert/opengl/doc/glOrtho.html). More... |
| |
| static Matrix4T< T > | orthogonalProjection (T left, T right, T bottom, T top, T nearPlane, T farPlane) |
| | Creates an orthogonal projection matrix. More... |
| |
| static Matrix4T< T > | perspectiveProjection (T fovY, T aspect, T nearPlane, T farPlane) |
| | Creates a perspective projection matrix. More... |
| |
|
static int | rows () |
| | Returns the number of rows (4) |
| |
| static Matrix4T< T > | simpleProjection (T width, T height, T fovy=Nimble::Math::PI *0.5) |
| | Creates a new WPCV-matrix (window-projection-camera-view -matrix) Camera is positioned so that 0,0,0 is mapped to 0,0,0 and w,h,0 is mapped to w,h,0. More... |
| |
| static Matrix4T< T > | transformation (T angle, const Vector3T< T > &axis, const Vector3T< T > &scale, const Vector3T< T > &translation) |
| | Returns a 3d transformation matrix that does scale, rotate & translation (in this order) More... |
| |
template<class T>
class Nimble::Matrix4T< T >
4x4 transformation matrix
This class is a row-major 4x4 matrix. The matrix functions (rotations etc.) assume right-handed coordinate system.
- Examples:
- AdvancedRenderingExample.cpp, and Widget3DExample.cpp.
Creates a new WPCV-matrix (window-projection-camera-view -matrix) Camera is positioned so that 0,0,0 is mapped to 0,0,0 and w,h,0 is mapped to w,h,0.
The projection matrix doesn't have the third row, no depth information, so no near/far values needed. (0,0,0) is lower left bottom, (w,h,0) is in right top, z increases towards the camera
- Parameters
-
| width | Width of the viewport |
| height | Height of the viewport |
| fovy | Field of view in y-direction in radians |
- Returns
- New projection matrix