glVertex  5.5.2
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
mat4 Class Reference

4x4 double matrix More...

#include <glslmath.h>

Public Member Functions

 mat4 (double diag=1.0)
 default constructor
 
 mat4 (const vec4 &diag)
 custom constructor
 
 mat4 (const vec4 &r1, const vec4 &r2, const vec4 &r3, const vec4 &r4=vec4(0, 0, 0, 1))
 custom constructor
 
 mat4 (const mat3 &m)
 copy constructor
 
 mat4 (const mat4f &m)
 copy constructor
 
vec4 operator[] (const int i) const
 subscript operator (column getter)
 
vec4 row (const int i) const
 row getter
 
vec4 col (const int i) const
 column getter
 
 operator mat3 () const
 down cast operator
 
mat3 getRotation () const
 get 3x3 rotation submatrix (matrix is assumed to be orthonormal)
 
vec3 getTranslation () const
 get translation column vector (matrix is assumed to be affine)
 
const double * c_ptr () const
 const pointer to column-major array
 
 operator const double * () const
 cast operator to column-major array
 
void fromOpenGL (const double m[16])
 convert from 16-element column-major OpenGL matrix
 
double det () const
 calculate determinant of 4x4 matrix
 
mat4 transpose () const
 transpose 4x4 matrix
 
mat4 invert () const
 invert 4x4 matrix
 
mat4operator+= (const mat4 &m)
 inplace addition
 
mat4operator*= (const mat4 &m)
 inplace multiplication
 
mat4operator<<= (const mat4 &m)
 inplace multiplication (left-hand side)
 
mat4operator>>= (const mat4 &m)
 inplace multiplication (right-hand side)
 
 operator std::string ()
 string cast operator
 

Static Public Member Functions

static mat4 columns (const vec4 &c1, const vec4 &c2, const vec4 &c3, const vec4 &c4)
 construct matrix from column vectors
 
static mat4 columns (double a, double b, double c, double d, double e, double f, double g, double h, double i, double j, double k, double l, double m, double n, double o, double p)
 construct matrix from column vectors
 
static mat4 rows (const vec4 &r1, const vec4 &r2, const vec4 &r3, const vec4 &r4)
 construct matrix from row vectors
 
static mat4 rows (double a, double b, double c, double d, double e, double f, double g, double h, double i, double j, double k, double l, double m, double n, double o, double p)
 construct matrix from row vectors
 
static double det (const mat4 &m)
 static version of determinant operation
 
static mat4 transpose (const mat4 &m)
 static version of transpose operation
 
static mat4 invert (const mat4 &m)
 static version of invert operation
 
static mat4 scale (double s, double t, double r, double w=1.0)
 create scaling matrix
 
static mat4 scale (const vec4 &c)
 create scaling matrix
 
static mat4 translate (double x, double y, double z)
 create translation matrix
 
static mat4 translate (const vec4 &v)
 create translation matrix
 
static mat4 rotate (double angle, double vx, double vy, double vz)
 create rotation matrix More...
 
static mat4 rotate (double angle, const vec3 &v)
 create rotation matrix More...
 
static mat4 rotate (const vec3 &from, const vec3 &to)
 create rotation matrix More...
 
static mat4 rigid (double a, const vec3 &v, const vec3 &t)
 create rigid-body transformation matrix More...
 
static mat4 transform (const mat3 &m, const vec3 &v)
 create affine (resp. More...
 
static mat4 transform (const vec3 &o, const vec3 &x, const vec3 &y, const vec3 &z)
 create affine transformation matrix More...
 
static mat4 transform (const vec3 &from, const vec3 &to, const vec3 &up=vec3(0, 1, 0), bool scale=true)
 create linear transformation matrix More...
 
static mat4 ortho (double l, double r, double b, double t, double n=-1, double f=1)
 create orthographic matrix
 
static mat4 frustum (double l, double r, double b, double t, double n, double f)
 create frustum matrix
 
static mat4 parallel (const vec3 &p, const vec3 &n, const vec3 &d)
 create parallel projection matrix
 
static mat4 perspective (double fovy, double aspect, double znear, double zfar)
 create perspective matrix
 
static mat4 lookat (const vec3 &eye, const vec3 &center, const vec3 &up=vec3(0, 1, 0))
 create lookat matrix
 

Protected Attributes

union {
}; 
 matrix elements
 

Detailed Description

4x4 double matrix

Member Function Documentation

◆ rigid()

static mat4 mat4::rigid ( double  a,
const vec3 v,
const vec3 t 
)
inlinestatic

create rigid-body transformation matrix

  • a is the rotation angle
  • v is the rotation axis
  • t is the translation vector

◆ rotate() [1/3]

static mat4 mat4::rotate ( const vec3 from,
const vec3 to 
)
inlinestatic

create rotation matrix

  • rotation is specified as a transformation from one direction to another one

◆ rotate() [2/3]

static mat4 mat4::rotate ( double  angle,
const vec3 v 
)
inlinestatic

create rotation matrix

  • rotation angle is specified clockwise in OpenGL coordinates

◆ rotate() [3/3]

static mat4 mat4::rotate ( double  angle,
double  vx,
double  vy,
double  vz 
)
inlinestatic

create rotation matrix

  • rotation angle is specified clockwise in OpenGL coordinates

◆ transform() [1/3]

mat4 mat4::transform ( const mat3 m,
const vec3 v 
)
inlinestatic

create affine (resp.

create affine (resp. linear) transformation matrix

linear) transformation matrix

  • m is the rotation (resp. linear) matrix
  • v is the translation vector

◆ transform() [2/3]

mat4 mat4::transform ( const vec3 from,
const vec3 to,
const vec3 up = vec3(0,1,0),
bool  scale = true 
)
inlinestatic

create linear transformation matrix

  • from is the transformed left point
  • to is the transformed right point
  • normal is the transformed orthogonal up vector

◆ transform() [3/3]

mat4 mat4::transform ( const vec3 o,
const vec3 x,
const vec3 y,
const vec3 z 
)
inlinestatic

create affine transformation matrix

  • o is the origin of the transformed coordinate system
  • x/y/z are the (unit length) base vectors of the transformed coordinate system

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