clan::Mat4< Type > Class Template Reference

4D matrix More...

#include <mat2.h>

Public Member Functions

Operations
Mat4< Type > & scale_self (Type x, Type y, Type z)
 Scale this matrix. More...
 
Mat4< Type > & scale_self (const Vec3< Type > &scale)
 Scale this matrix. More...
 
Mat4< Type > & translate_self (Type x, Type y, Type z)
 Translate this matrix. More...
 
Mat4< Type > & translate_self (const Vec3< Type > &translation)
 Translate this matrix. More...
 
Mat4< Type > & set_translate (Type x, Type y, Type z)
 Set this matrix translation values. More...
 
Mat4< Type > & set_translate (const Vec3< Type > &translation)
 Set this matrix translation values. More...
 
double det () const
 Calculate the matrix determinant of this matrix. More...
 
Mat4< Type > & adjoint ()
 Calculate the adjoint (or known as adjugate) of this matrix. More...
 
Mat4< Type > & inverse ()
 Calculate the matrix inverse of this matrix. More...
 
Mat4< Type > & transpose ()
 Calculate the transpose of this matrix. More...
 
void decompose (Vec3< Type > &out_position, Quaternionx< Type > &out_orientation, Vec3< Type > &out_scale) const
 Decompose matrix into position, orientation/rotation and scale. More...
 
bool is_equal (const Mat4< Type > &other, Type epsilon) const
 Returns true if equal within the bounds of an epsilon. More...
 
Operators
 operator Type const * () const
 Operator that returns the matrix as a array. More...
 
 operator Type * ()
 Operator that returns the matrix as a array. More...
 
Type & operator[] (int i)
 Operator that returns the matrix cell at the given index. More...
 
const Type & operator[] (int i) const
 Operator that returns the matrix cell at the given index. More...
 
Type & operator[] (unsigned int i)
 Operator that returns the matrix cell at the given index. More...
 
const Type & operator[] (unsigned int i) const
 Operator that returns the matrix cell at the given index. More...
 
Mat4< Type > & operator= (const Mat4< Type > &copy)
 Copy assignment operator. More...
 
Mat4< Type > & operator= (const Mat3< Type > &copy)
 Copy assignment operator. More...
 
Mat4< Type > & operator= (const Mat2< Type > &copy)
 Copy assignment operator. More...
 
Mat4< Type > operator* (const Mat4< Type > &mult) const
 Multiplication operator. More...
 
Mat4< Type > operator+ (const Mat4< Type > &add_matrix) const
 Addition operator. More...
 
Mat4< Type > operator- (const Mat4< Type > &sub_matrix) const
 Subtraction operator. More...
 
bool operator== (const Mat4< Type > &other) const
 Equality operator. More...
 
bool operator!= (const Mat4< Type > &other)
 Not-equal operator. More...
 

Construction

 Mat4 ()
 Constructs a 4x4 matrix (zero'ed) More...
 
 Mat4 (const Mat4< Type > &copy)
 Constructs a 4x4 matrix (copied) More...
 
 Mat4 (const Mat2< Type > &copy)
 Constructs a 4x4 matrix (copied from a 2d matrix) More...
 
 Mat4 (const Mat3< Type > &copy)
 Constructs a 4x4 matrix (copied from a 3d matrix) More...
 
 Mat4 (const float *init_matrix)
 Constructs a 4x4 matrix (copied from a array of floats) More...
 
 Mat4 (const double *init_matrix)
 Constructs a 4x4 matrix (copied from a array of doubles) More...
 
 Mat4 (const int64_t *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 64 bit integers) More...
 
 Mat4 (const int32_t *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 32 bit integers) More...
 
 Mat4 (const int16_t *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 16 bit integers) More...
 
 Mat4 (const int8_t *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 8 bit integers) More...
 
static Mat4< Type > null ()
 Create a zero matrix. More...
 
static Mat4< Type > identity ()
 Create the identity matrix. More...
 
static Mat4< Type > frustum (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far, Handedness handedness, ClipZRange clip_z)
 Create a frustum matrix. More...
 
static Mat4< Type > perspective (Type field_of_view_y_degrees, Type aspect, Type z_near, Type z_far, Handedness handedness, ClipZRange clip_z)
 Create a perspective matrix. More...
 
static Mat4< Type > ortho (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far, Handedness handedness, ClipZRange clip_z)
 Create a ortho matrix. More...
 
static Mat4< Type > ortho_2d (Type left, Type right, Type bottom, Type top, Handedness handedness, ClipZRange clip_z)
 Create a ortho_2d matrix. More...
 
static Mat4< Type > rotate (const Angle &angle, Type x, Type y, Type z, bool normalize=true)
 Create a rotation matrix. More...
 
static Mat4< Type > rotate (const Angle &angle, Vec3< Type > rotation, bool normalize=true)
 Create a rotation matrix. More...
 
static Mat4< Type > rotate (const Angle &angle_x, const Angle &angle_y, const Angle &angle_z, EulerOrder order)
 Create a rotation matrix using euler angles. More...
 
static Mat4< Type > scale (Type x, Type y, Type z)
 Create a scale matrix. More...
 
static Mat4< Type > scale (const Vec3< Type > &xyz)
 Create a scale matrix. More...
 
static Mat4< Type > translate (Type x, Type y, Type z)
 Create a translation matrix. More...
 
static Mat4< Type > translate (const Vec3< Type > &xyz)
 Create a translation matrix. More...
 
static Mat4< Type > look_at (Type eye_x, Type eye_y, Type eye_z, Type center_x, Type center_y, Type center_z, Type up_x, Type up_y, Type up_z)
 Create the "look at" matrix. More...
 
static Mat4< Type > look_at (Vec3< Type > eye, Vec3< Type > center, Vec3< Type > up)
 Create the "look at" matrix. More...
 
static Mat4< Type > multiply (const Mat4< Type > &matrix_1, const Mat4< Type > &matrix_2)
 Multiply 2 matrices. More...
 
static Mat4< Type > add (const Mat4< Type > &matrix_1, const Mat4< Type > &matrix_2)
 Add 2 matrices. More...
 
static Mat4< Type > subtract (const Mat4< Type > &matrix_1, const Mat4< Type > &matrix_2)
 Subtract 2 matrices. More...
 
static Mat4< Type > adjoint (const Mat4< Type > &matrix)
 Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix. More...
 
static Mat4< Type > inverse (const Mat4< Type > &matrix)
 Calculate the matrix inverse of a matrix. More...
 
static Mat4< Type > transpose (const Mat4< Type > &matrix)
 Calculate the transpose of a matrix. More...
 
static bool is_equal (const Mat4< Type > &first, const Mat4< Type > &second, Type epsilon)
 Returns true if equal within the bounds of an epsilon. More...
 

Attributes

Type matrix [16]
 The matrix (in column-major format) More...
 
Vec3< Type > get_translate () const
 Returns the translation coordinates for this matrix (in column-major format) More...
 
Vec3< Type > get_euler (EulerOrder order) const
 Extract the euler angles (in radians) from a matrix (in column-major format) More...
 
Vec3< Type > get_transformed_point (const Vec3< Type > &vector) const
 Get a transformed point from the matrix (in column-major format) More...
 

Detailed Description

template<typename Type>
class clan::Mat4< Type >

4D matrix

These matrix templates are defined for: int (Mat4i), float (Mat4f), double (Mat4d)


The documentation for this class was generated from the following files: