14 #ifndef SRC_MATRIX4_H_
15 #define SRC_MATRIX4_H_
123 const float r1c1,
const float r1c2,
const float r1c3,
const float r1c4,
124 const float r2c1,
const float r2c2,
const float r2c3,
const float r2c4,
125 const float r3c1,
const float r3c2,
const float r3c3,
const float r3c4,
126 const float r4c1,
const float r4c2,
const float r4c3,
const float r4c4
189 static Matrix4 Perspective(
float fov_y_in_degrees,
float aspect_ratio,
float near_plane_dist,
float far_plane_dist);
192 static Matrix4 Frustum(
float left,
float right,
float bottom,
float top,
float near_plane_dist,
float far_plane_dist);
A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...
float Determinant() const
Returns the determinant of the 4x4 matrix.
static Matrix4 Scale(const Vector3 &v)
Returns the scale matrix described by the vector.
Matrix4(const float *a)
Constructs a matrix given from an array of 16 floats in OpenGL matrix format (i.e....
Matrix4(const std::vector< float > &a)
Constructs a matrix given from a vector of 16 floats in OpenGL matrix format (i.e....
Matrix4 Cofactor() const
Returns the cofactor matrix.
static Matrix4 Perspective(float fov_y_in_degrees, float aspect_ratio, float near_plane_dist, float far_plane_dist)
Returns a perspective projection matrix equivalent to the one gluPerspective creates.
const float * value_ptr() const
Returns a pointer to the raw data array used to store the matrix. This is a 1D array of 16-elements s...
float SubDeterminant(int exclude_row, int exclude_col) const
Returns the determinant of the 3x3 matrix formed by excluding the specified row and column from the 4...
static Matrix4 LookAt(Point3 eye, Point3 target, Vector3 up)
Returns a view matrix that centers the camera at the 'eye' position and orients it to look at the des...
float & operator()(const int row, const int col)
Access an individual element of the array using the syntax: Matrix4 mat; mat(1,2) = 1....
static Matrix4 RotationX(const float radians)
Returns the rotation matrix about the x axis by the specified angle.
Matrix4(const Matrix4 &m2)
Copy constructor.
static Matrix4 RotationZ(const float radians)
Returns the rotation matrix about the z axis by the specified angle.
std::vector< float > ToVector() const
Matrix4()
The default constructor creates an identity matrix:
Vector3 ColumnToVector3(int c) const
Returns the c-th column of the matrix as a Vector type, e.g.,: Vector3 xAxis = mat....
virtual ~Matrix4()
Destructor.
static Matrix4 Frustum(float left, float right, float bottom, float top, float near_plane_dist, float far_plane_dist)
Returns a projection matrix equivalent the one glFrustum creates.
Matrix4 Orthonormal() const
Returns an orthonormal version of the matrix, i.e., guarantees that the rotational component of the m...
Matrix4 & operator=(const Matrix4 &m2)
Matrix assignment operator.
bool operator==(const Matrix4 &m2) const
Check for "equality", taking floating point imprecision into account.
float operator()(const int row, const int col) const
Access an individual element of the array using the syntax: Matrix4 mat; float row1col2 = mat(1,...
bool operator!=(const Matrix4 &m2) const
Check for "inequality", taking floating point imprecision into account.
Matrix4 Inverse() const
Returns the inverse of the 4x4 matrix if it is nonsingular. If it is singular, then returns the ident...
float operator[](const int i) const
Accesses the ith element of the raw data array used to store the matrix. This is a 1D array of 16-ele...
static Matrix4 Rotation(const Point3 &p, const Vector3 &v, const float a)
Returns the rotation matrix around the vector v placed at point p, rotate by angle a.
static Matrix4 FromRowMajorElements(const float r1c1, const float r1c2, const float r1c3, const float r1c4, const float r2c1, const float r2c2, const float r2c3, const float r2c4, const float r3c1, const float r3c2, const float r3c3, const float r3c4, const float r4c1, const float r4c2, const float r4c3, const float r4c4)
Returns a matrix constructed from individual elements passed in row major order so that the matrix lo...
static Matrix4 Align(const Point3 &a_p, const Vector3 &a_v1, const Vector3 &a_v2, const Point3 &b_p, const Vector3 &b_v1, const Vector3 &b_v2)
Creates a transformation matrix that maps a coordinate space, a, defined one point,...
static Matrix4 Translation(const Vector3 &v)
Returns the translation matrix described by the vector.
Point3 ColumnToPoint3(int c) const
Returns the c-th column of the matrix as a Vector type, e.g.,: Point3 pos = mat.getColumnAsPoint3(3);...
static Matrix4 RotationY(const float radians)
Returns the rotation matrix about the y axis by the specified angle.
float & operator[](const int i)
Accesses the ith element of the raw data array used to store the matrix. This is a 1D array of 16-ele...
Matrix4 Transpose() const
Returns the transpose of the matrix.
A 3D Point with floating point coordinates, used for storing vertices and all sorts of other 3D graph...
Stores the mathematical object of a ray that begins at an origin (a 3D point) and points in a directi...
A 3D Vector with floating point coordinates, used for storing normals and all sorts of other 3D graph...
Namespace for the MinGfx Toolkit.
std::ostream & operator<<(std::ostream &os, const Color &c)
std::istream & operator>>(std::istream &is, Color &c)
Matrix4 operator*(const Matrix4 &m, const float &s)
Multiply matrix and scalar, returns the new matrix.