|
CGVIS Utils
|
#include <Mat4.h>
Classes | |
| struct | StereoMatrices |
| Bundle of left/right view and projection matrices for stereo. More... | |
Public Member Functions | |
| Mat4t () | |
| Construct identity matrix. | |
| Mat4t (T m11, T m12, T m13, T m14, T m21, T m22, T m23, T m24, T m31, T m32, T m33, T m34, T m41, T m42, T m43, T m44) | |
| Construct from 16 elements (column-major order). | |
| Mat4t (const std::array< T, 16 > &e) | |
| Construct from a raw array of 16 elements. | |
| Mat4t (const Vec3t< T > &e1, T e14, const Vec3t< T > &e2, T e24, const Vec3t< T > &e3, T e34, const Vec3t< T > &e4=Vec3(0, 0, 0), T e44=1) | |
| Construct from three Vec3 column vectors and their last column entries. | |
| Mat4t (const Mat4t &other) | |
| Copy-construct from another matrix. | |
| const std::string | toString () const |
| String representation (pretty-printed rows). | |
| operator T* (void) | |
| Implicit conversion to raw pointer (non-const). | |
| operator const T * (void) const | |
| Implicit conversion to raw pointer (const). | |
| Mat4t | operator* (T scalar) const |
| Component-wise multiplication by scalar. | |
| Mat4t | operator+ (T scalar) const |
| Component-wise addition of scalar. | |
| Mat4t | operator- (T scalar) const |
| Component-wise subtraction of scalar. | |
| Mat4t | operator/ (T scalar) const |
| Component-wise division by scalar. | |
| Mat4t | operator* (const Mat4t &other) const |
| Matrix–matrix product (column-major; standard linear algebra). | |
| Vec2t< T > | operator* (const Vec2t< T > &other) const |
| Transform a 2D vector (homogeneous with z=0,w=1) and drop back to 2D. | |
| Vec3t< T > | operator* (const Vec3t< T > &other) const |
| Transform a 3D point using homogeneous divide. | |
| Vec4t< T > | operator* (const Vec4t< T > &other) const |
| Transform a 4D homogeneous vector. | |
Static Public Member Functions | |
| static Mat4t | scaling (T scale) |
Uniform scaling by scale on all axes. | |
| static Mat4t | scaling (const Vec3t< T > &scale) |
Non-uniform scaling by components of scale. | |
| static Mat4t | translation (const Vec3t< T > &trans) |
Translation by vector trans. | |
| static Mat4t | translation (T x, T y, T z) |
| Translation by components. | |
| static Mat4t | scaling (T x, T y, T z) |
| Non-uniform scaling by components. | |
| static Mat4t | rotationX (T degree) |
Rotation about the X-axis by degree (degrees). | |
| static Mat4t | rotationY (T degree) |
Rotation about the Y-axis by degree (degrees). | |
| static Mat4t | rotationZ (T degree) |
Rotation about the Z-axis by degree (degrees). | |
| static Mat4t | rotationAxis (const Vec3t< T > &axis, T degree) |
Rotation about an arbitrary axis by degree (degrees). | |
| static Mat4t | transpose (const Mat4t &m) |
| Matrix transpose. | |
| static T | det (const Mat4t &m) |
| Determinant of a 4×4 matrix. | |
| static Mat4t | inverse (const Mat4t &m) |
| Matrix inverse computed via adjugate and determinant. | |
| static Mat4t | inverse (const Mat4t &m, T det) |
| Matrix inverse with precomputed determinant. | |
| static Mat4t | perspective (T fovy, T aspect, T znear, T zfar) |
| Perspective projection from vertical FOV and aspect ratio. | |
| static Mat4t | perspective (T left, T right, T bottom, T top, T znear, T zfar) |
| Off-center perspective projection from frustum bounds. | |
| static Mat4t | ortho (T left, T right, T bottom, T top, T znear, T zfar) |
| Orthographic projection from axis-aligned view volume. | |
| static Mat4t | lookAt (const Vec3t< T > &vEye, const Vec3t< T > &vAt, const Vec3t< T > &vUp) |
Right-handed view matrix that looks from vEye to vAt with up vUp. | |
| static Mat4t | mirror (const Vec3t< T > &p, const Vec3t< T > &n) |
Reflection matrix for a plane through point p with normal n. | |
| static StereoMatrices | stereoLookAtAndProjection (const Vec3t< T > &eye, const Vec3t< T > &at, const Vec3t< T > &up, T fovy, T aspect, T znear, T zfar, T focalLength, T eyeDist) |
| Convenience builder for stereo view and projection matrices. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Mat4t &m) |
| Stream insertion using toString(). | |
|
inline |
Construct from 16 elements (column-major order).
| m11..m44 | Elements of the matrix in column-major order. |
Construct from a raw array of 16 elements.
| e | Array in column-major order. |
|
inline |
Construct from three Vec3 column vectors and their last column entries.
| e1,e2,e3 | Columns 1–3 (x,y,z components). |
| e14,e24,e34 | Elements of the 4th row for columns 1–3. |
| e4 | Optional 4th column (xyz); defaults to (0,0,0). |
| e44 | Optional (4,4) element; defaults to 1. |
Copy-construct from another matrix.
Determinant of a 4×4 matrix.
Matrix inverse computed via adjugate and determinant.
| m | Input matrix. |
m. Matrix inverse with precomputed determinant.
| m | Input matrix. |
| det | Determinant of m. |
m. det ≠ 0. 2
3
4
|
inlinestatic |
Right-handed view matrix that looks from vEye to vAt with up vUp.
Equivalent to the common LookAt construction (OpenGL style).
|
inlinestatic |
Reflection matrix for a plane through point p with normal n.
|
inline |
Implicit conversion to raw pointer (const).
e[0].
|
inline |
Implicit conversion to raw pointer (non-const).
e[0]. Matrix–matrix product (column-major; standard linear algebra).
Transform a 2D vector (homogeneous with z=0,w=1) and drop back to 2D.
Transform a 3D point using homogeneous divide.
Uses w = M[3]*p + 1*e[15]. The result is divided by w.
Transform a 4D homogeneous vector.
Component-wise multiplication by scalar.
Component-wise addition of scalar.
Component-wise subtraction of scalar.
Component-wise division by scalar.
|
inlinestatic |
Orthographic projection from axis-aligned view volume.
|
inlinestatic |
Perspective projection from vertical FOV and aspect ratio.
| fovy | Vertical field of view in degrees. |
| aspect | Aspect ratio (width / height). |
| znear | Near plane distance (> 0). |
| zfar | Far plane distance (> znear). |
|
inlinestatic |
Off-center perspective projection from frustum bounds.
| left,right,bottom,top | Frustum bounds at the near plane. |
| znear,zfar | Near and far plane distances. |
|
inlinestatic |
Rotation about an arbitrary axis by degree (degrees).
| axis | Unit rotation axis (not normalized internally). |
| degree | Rotation angle in degrees (right-handed). |
Rotation about the X-axis by degree (degrees).
Rotation about the Y-axis by degree (degrees).
Rotation about the Z-axis by degree (degrees).
Non-uniform scaling by components of scale.
Uniform scaling by scale on all axes.
Non-uniform scaling by components.
|
inlinestatic |
Convenience builder for stereo view and projection matrices.
| eye | Camera position. |
| at | Look-at target point. |
| up | Up direction. |
| fovy | Vertical field of view in degrees. |
| aspect | Aspect ratio (width/height). |
| znear,zfar | Near/Far plane distances. |
| focalLength | Distance from eye to focus plane used for frustum shift. |
| eyeDist | Inter-pupillary distance (eye separation). |
|
inline |
String representation (pretty-printed rows).
Translation by vector trans.
Translation by components.
Matrix transpose.
|
friend |
Stream insertion using toString().