cpe::matrix4 Class Reference

Matrix 4x4. More...

Public Member Functions

 matrix4 ()
 empty constructor (identity)
 
 matrix4 (const double &x00, const double &x01, const double &x02, const double &x03, const double &x10, const double &x11, const double &x12, const double &x13, const double &x20, const double &x21, const double &x22, const double &x23, const double &x30, const double &x31, const double &x32, const double &x33)
 direct constructor with every value
 
 matrix4 (const matrix3 &m)
 direct constructor from matrix 3
 
const double & operator() (const size_t &k1, const size_t &k2) const
 Access to the k_th entry (k in [0,3])
 
double & operator() (const size_t &k1, const size_t &k2)
 Access to the k_th entry (k in [0,3])
 
const double * pointer () const
 fast pointer access
 
double * pointer_unprotected ()
 fast pointer access
 
matrix4 operator+ (const matrix4 &m2) const
 
  • operator

 
matrix4 operator+ (const double &s) const
 
  • operator

 
matrix4 operator- (const matrix4 &m2) const
 
  • operator

 
matrix4 operator- (const double &s) const
 
  • operator

 
matrix4 operator* (const double &s) const
 multiply by a scalar operator
 
v4 operator* (const v4 &v) const
 multiply matrix with a v4
 
v3 operator* (const v3 &v) const
 multiply matrix with a v3 (assume (v3.x,v3.y,v3.z,1) and normalize)
 
matrix4 operator* (const matrix4 &m2) const
 matrix mulitplication
 
matrix4 operator/ (const double &s) const
 divide by a scalar operator
 
matrix4operator+= (const matrix4 &m)
 internal +
 
matrix4operator+= (const double &s)
 internal +
 
matrix4operator-= (const matrix4 &m)
 internal -
 
matrix4operator-= (const double &s)
 internal -
 
matrix4operator*= (const double &s)
 internal *
 
matrix4operator/= (const double &s)
 internal /
 
matrix4 operator- () const
 unary negation
 
matrix4 product_compontentwise (const matrix4 &m) const
 does componentwise multiplication
 
matrix4product_compontentwise_internal (const matrix4 &m)
 does componentwise multiplication
 
matrix4 transposed () const
 transpose matrix
 
matrix4 translated (const v3 &translation) const
 Translated matrix (return of copy of the translated matrix)
 
void translate_internal (const v3 &translation)
 Translated matrix (modify the matrix)
 
std::vector< double > to_vector () const
 convert 4x4 matrix into a 16 vector of double (glMultmatrixf)
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

double m [16]
 internal storage of the matrix
 

Detailed Description

Matrix 4x4.

Constructor & Destructor Documentation

cpe::matrix4::matrix4 ( const double &  x00,
const double &  x01,
const double &  x02,
const double &  x03,
const double &  x10,
const double &  x11,
const double &  x12,
const double &  x13,
const double &  x20,
const double &  x21,
const double &  x22,
const double &  x23,
const double &  x30,
const double &  x31,
const double &  x32,
const double &  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()().

+ Here is the caller graph for this function:

matrix4 cpe::matrix4::identity ( )
static

build identity matrix

References matrix4().

+ Here is the call graph for this function:

const double & 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:

double & 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* ( const double &  s) const

multiply by a scalar operator

References m.

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

multiply matrix with a v4

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

+ Here is the call graph for this function:

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

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

References m, cpe::v3::x(), cpe::v3::y(), and cpe::v3::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*= ( const double &  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+ ( const double &  s) const

  • operator

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

internal +

References m.

matrix4 & cpe::matrix4::operator+= ( const double &  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- ( const double &  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-= ( const double &  s)

internal -

References m.

matrix4 cpe::matrix4::operator/ ( const double &  s) const

divide by a scalar operator

References m, and matrix4().

+ Here is the call graph for this function:

matrix4 & cpe::matrix4::operator/= ( const double &  s)

internal /

References m.

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

fast pointer access

Warning
unprotected access

References m.

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

+ Here is the caller graph for this function:

double * cpe::matrix4::pointer_unprotected ( )

fast pointer access

Warning
unprotected access

References m.

Referenced by operator*().

+ Here is the caller graph for this function:

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 ( const double &  left,
const double &  right,
const double &  bottom,
const double &  top,
const double &  near,
const double &  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 v3 eye,
const v3 center,
const v3 up 
)
static

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

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

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

matrix4 cpe::matrix4::projection_orthographic ( const double &  left,
const double &  right,
const double &  bottom,
const double &  top,
const double &  near,
const double &  far 
)
static

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

References matrix4().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

matrix4 cpe::matrix4::projection_perspective ( const double &  fovy,
const double &  aspect,
const double &  z_near,
const double &  z_far 
)
static

build a perspective projection similar to gluPerspective

Parameters
doublefovy: 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 v3 axis,
const double &  angle 
)
static

build rotation matrix

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

+ Here is the call graph for this function:

matrix4 cpe::matrix4::scale ( const double &  s)
static

build scaling matrix

References matrix4().

+ Here is the call graph for this function:

matrix4 cpe::matrix4::scale ( const double &  s_x,
const double &  s_y,
const double &  s_z,
const double &  s_w 
)
static

build scaling matrix

References matrix4().

+ Here is the call graph for this function:

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

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

References m.

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

build from matrix3 and translation

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

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Translated matrix (modify the matrix)

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

Referenced by translated().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

matrix4 cpe::matrix4::translated ( const v3 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 v3 translation)
static

build translation matrix

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

Referenced by projection_look_at().

+ Here is the call graph for this function:

+ Here is the caller 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:

+ Here is the caller graph for this function:

Member Data Documentation


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