cpe::matrix4 Class Reference

Matrix 4x4. More...

Public Member Functions

 matrix4 ()
 empty constructor (identity) More...
 
 matrix4 (float x00, float x01, float x02, float x03, float x10, float x11, float x12, float x13, float x20, float x21, float x22, float x23, float x30, float x31, float x32, float x33)
 direct constructor with every value More...
 
 matrix4 (const matrix3 &m)
 direct constructor from matrix 3 More...
 
float operator() (const size_t &k1, const size_t &k2) const
 Access to the k_th entry (k in [0,3]) More...
 
float & operator() (const size_t &k1, const size_t &k2)
 Access to the k_th entry (k in [0,3]) More...
 
const float * pointer () const
 fast pointer access More...
 
float * pointer_unprotected ()
 fast pointer access More...
 
matrix4 operator+ (const matrix4 &m2) const
 
  • operator
More...
 
matrix4 operator+ (float s) const
 
  • operator
More...
 
matrix4 operator- (const matrix4 &m2) const
 
  • operator
More...
 
matrix4 operator- (float s) const
 
  • operator
More...
 
matrix4 operator* (float s) const
 multiply by a scalar operator More...
 
vec4 operator* (const vec4 &v) const
 multiply matrix with a v4 More...
 
vec3 operator* (const vec3 &v) const
 multiply matrix with a v3 (assume (v3.x,v3.y,v3.z,1) and normalize) More...
 
matrix4 operator* (const matrix4 &m2) const
 matrix mulitplication More...
 
matrix4 operator/ (float s) const
 divide by a scalar operator More...
 
matrix4operator+= (const matrix4 &m)
 internal + More...
 
matrix4operator+= (float s)
 internal + More...
 
matrix4operator-= (const matrix4 &m)
 internal - More...
 
matrix4operator-= (float s)
 internal - More...
 
matrix4operator*= (float s)
 internal * More...
 
matrix4operator/= (float s)
 internal / More...
 
matrix4 operator- () const
 unary negation More...
 
matrix4 product_compontentwise (const matrix4 &m) const
 does componentwise multiplication More...
 
matrix4product_compontentwise_internal (const matrix4 &m)
 does componentwise multiplication More...
 
matrix4 transposed () const
 transpose matrix More...
 
matrix4 translated (const vec3 &translation) const
 Translated matrix (return of copy of the translated matrix) More...
 
void translate_internal (const vec3 &translation)
 Translated matrix (modify the matrix) More...
 
std::vector< float > to_vector () const
 convert 4x4 matrix into a 16 vector of float (glMultmatrixf) More...
 

Static Public Member Functions

static matrix4 identity ()
 build identity matrix More...
 
static matrix4 zeros ()
 build zero matrix More...
 
static matrix4 rotation (const vec3 &axis, float angle)
 build rotation matrix More...
 
static matrix4 scale (float s)
 build scaling matrix More...
 
static matrix4 scale (float s_x, float s_y, float s_z, float s_w)
 build scaling matrix More...
 
static matrix4 translation (const vec3 &translation)
 build translation matrix More...
 
static matrix4 transformation (const matrix3 &m3, const vec3 &translation)
 build from matrix3 and translation More...
 
static matrix4 projection_perspective (float fovy, float aspect, float z_near, float z_far)
 build a perspective projection similar to gluPerspective More...
 
static matrix4 projection_frustum (float left, float right, float bottom, float top, float near, float far)
 build a perspective projection (frustum) similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml More...
 
static matrix4 projection_orthographic (float left, float right, float bottom, float top, float near, float far)
 build an orthographic projection similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml More...
 
static matrix4 projection_look_at (const matrix4 &current_matrix, const vec3 &eye, const vec3 &center, const vec3 &up)
 build a perspective projection similar to gluLookAt see: http://www.opengl.org/sdk/docs/man/xhtml/gluLookAt.xml More...
 

Private Member Functions

void assert_size (const size_t &k1, const size_t &k2) const
 assert that a size_t belongs to [[0,3]] More...
 

Private Attributes

float m [16]
 internal storage of the matrix More...
 

Detailed Description

Matrix 4x4.

Constructor & Destructor Documentation

cpe::matrix4::matrix4 ( float  x00,
float  x01,
float  x02,
float  x03,
float  x10,
float  x11,
float  x12,
float  x13,
float  x20,
float  x21,
float  x22,
float  x23,
float  x30,
float  x31,
float  x32,
float  x33 
)

direct constructor with every value

References m.

cpe::matrix4::matrix4 ( const matrix3 m)

direct constructor from matrix 3

References m.

Member Function Documentation

void cpe::matrix4::assert_size ( const size_t &  k1,
const size_t &  k2 
) const
private

assert that a size_t belongs to [[0,3]]

Referenced by operator()().

matrix4 cpe::matrix4::identity ( )
static

build identity matrix

References matrix4().

+ Here is the call graph for this function:

float cpe::matrix4::operator() ( const size_t &  k1,
const size_t &  k2 
) const

Access to the k_th entry (k in [0,3])

References assert_size(), and m.

+ Here is the call graph for this function:

float & cpe::matrix4::operator() ( const size_t &  k1,
const size_t &  k2 
)

Access to the k_th entry (k in [0,3])

References assert_size(), and m.

+ Here is the call graph for this function:

matrix4 cpe::matrix4::operator* ( float  s) const

multiply by a scalar operator

vec4 cpe::matrix4::operator* ( const vec4 v) const

multiply matrix with a v4

References m, cpe::vec4::w(), cpe::vec4::x(), cpe::vec4::y(), and cpe::vec4::z().

+ Here is the call graph for this function:

vec3 cpe::matrix4::operator* ( const vec3 v) const

multiply matrix with a v3 (assume (v3.x,v3.y,v3.z,1) and normalize)

References m, cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::operator* ( const matrix4 m2) const

matrix mulitplication

References m, pointer_unprotected(), and zeros().

+ Here is the call graph for this function:

matrix4 & cpe::matrix4::operator*= ( float  s)

internal *

References m.

matrix4 cpe::matrix4::operator+ ( const matrix4 m2) const

  • operator

References m, matrix4(), and pointer().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::operator+ ( float  s) const

  • operator

matrix4 & cpe::matrix4::operator+= ( const matrix4 m)

internal +

References m.

matrix4 & cpe::matrix4::operator+= ( float  s)

internal +

References m.

matrix4 cpe::matrix4::operator- ( const matrix4 m2) const

  • operator

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::operator- ( float  s) const

  • operator

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::operator- ( ) const

unary negation

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 & cpe::matrix4::operator-= ( const matrix4 m)

internal -

References m.

matrix4 & cpe::matrix4::operator-= ( float  s)

internal -

References m.

matrix4 cpe::matrix4::operator/ ( float  s) const

divide by a scalar operator

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 & cpe::matrix4::operator/= ( float  s)

internal /

References m.

const float * cpe::matrix4::pointer ( ) const

fast pointer access

Warning
unprotected access

References m.

Referenced by cpe::operator*(), operator+(), cpe::operator+(), cpe::operator-(), and cpe::operator<<().

float * cpe::matrix4::pointer_unprotected ( )

fast pointer access

Warning
unprotected access

References m.

Referenced by operator*().

matrix4 cpe::matrix4::product_compontentwise ( const matrix4 m) const

does componentwise multiplication

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 & cpe::matrix4::product_compontentwise_internal ( const matrix4 m)

does componentwise multiplication

References m.

matrix4 cpe::matrix4::projection_frustum ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)
static

build a perspective projection (frustum) similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml

References matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::projection_look_at ( const matrix4 current_matrix,
const vec3 eye,
const vec3 center,
const vec3 up 
)
static

build a perspective projection similar to gluLookAt see: http://www.opengl.org/sdk/docs/man/xhtml/gluLookAt.xml

References cpe::vec3::cross(), translation(), cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::projection_orthographic ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)
static

build an orthographic projection similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml

References matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::projection_perspective ( float  fovy,
float  aspect,
float  z_near,
float  z_far 
)
static

build a perspective projection similar to gluPerspective

Parameters
floatfovy: in radian see: http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml

References matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::rotation ( const vec3 axis,
float  angle 
)
static

build rotation matrix

References matrix4(), and cpe::vec3::normalized().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::scale ( float  s)
static

build scaling matrix

References matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::scale ( float  s_x,
float  s_y,
float  s_z,
float  s_w 
)
static

build scaling matrix

References matrix4().

+ Here is the call graph for this function:

std::vector< float > cpe::matrix4::to_vector ( ) const

convert 4x4 matrix into a 16 vector of float (glMultmatrixf)

References m.

matrix4 cpe::matrix4::transformation ( const matrix3 m3,
const vec3 translation 
)
static

build from matrix3 and translation

References matrix4(), cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().

+ Here is the call graph for this function:

void cpe::matrix4::translate_internal ( const vec3 translation)

Translated matrix (modify the matrix)

References m, cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().

Referenced by translated().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::translated ( const vec3 translation) const

Translated matrix (return of copy of the translated matrix)

References translate_internal().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::translation ( const vec3 translation)
static

build translation matrix

References matrix4(), cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().

Referenced by projection_look_at().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::transposed ( ) const

transpose matrix

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::zeros ( )
static

build zero matrix

References matrix4().

Referenced by operator*().

+ Here is the call graph for this function:

Member Data Documentation


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