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 |
| |
matrix4 | operator+ (float s) const |
| |
matrix4 | operator- (const matrix4 &m2) const |
| |
matrix4 | operator- (float s) const |
| |
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... | |
matrix4 & | operator+= (const matrix4 &m) |
internal + More... | |
matrix4 & | operator+= (float s) |
internal + More... | |
matrix4 & | operator-= (const matrix4 &m) |
internal - More... | |
matrix4 & | operator-= (float s) |
internal - More... | |
matrix4 & | operator*= (float s) |
internal * More... | |
matrix4 & | operator/= (float s) |
internal / More... | |
matrix4 | operator- () const |
unary negation More... | |
matrix4 | product_compontentwise (const matrix4 &m) const |
does componentwise multiplication More... | |
matrix4 & | product_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 ¤t_matrix, const vec3 &eye, const vec3 ¢er, 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... | |
Matrix 4x4.
cpe::matrix4::matrix4 | ( | ) |
empty constructor (identity)
References m.
Referenced by identity(), operator+(), operator-(), operator/(), product_compontentwise(), projection_frustum(), projection_orthographic(), projection_perspective(), rotation(), scale(), transformation(), translation(), transposed(), and zeros().
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.
|
private |
assert that a size_t belongs to [[0,3]]
References MACRO_EXCEPTION_PARAMETER.
Referenced by operator()().
|
static |
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.
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.
matrix4 cpe::matrix4::operator* | ( | float | s | ) | const |
multiply by a scalar operator
multiply matrix with a v4
References m, cpe::vec4::w(), cpe::vec4::x(), cpe::vec4::y(), and cpe::vec4::z().
multiply matrix with a v3 (assume (v3.x,v3.y,v3.z,1) and normalize)
References m, MACRO_EXCEPTION_PARAMETER, cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().
matrix mulitplication
References m, pointer_unprotected(), and zeros().
matrix4 cpe::matrix4::operator+ | ( | float | s | ) | const |
matrix4 cpe::matrix4::operator- | ( | float | s | ) | const |
matrix4 cpe::matrix4::operator- | ( | ) | const |
matrix4 cpe::matrix4::operator/ | ( | float | s | ) | const |
const float * cpe::matrix4::pointer | ( | ) | const |
fast pointer access
References m.
Referenced by glwidget::draw_orientation(), glwidget::draw_pointer(), cpe::matrix1x4::operator*(), cpe::operator*(), operator+(), cpe::operator+(), cpe::operator-(), cpe::operator<<(), and glwidget::paintGL().
float * cpe::matrix4::pointer_unprotected | ( | ) |
does componentwise multiplication
References m.
|
static |
build a perspective projection (frustum) similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml
References MACRO_EXCEPTION_PARAMETER, and matrix4().
|
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().
|
static |
build an orthographic projection similar to gluPerspective see: http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml
References MACRO_EXCEPTION_PARAMETER, and matrix4().
|
static |
build a perspective projection similar to gluPerspective
float | fovy: in radian see: http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml |
References MACRO_EXCEPTION_PARAMETER, and matrix4().
build rotation matrix
References matrix4(), and cpe::vec3::normalized().
|
static |
|
static |
std::vector< float > cpe::matrix4::to_vector | ( | ) | const |
convert 4x4 matrix into a 16 vector of float (glMultmatrixf)
References m.
build from matrix3 and translation
References matrix4(), cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().
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().
Translated matrix (return of copy of the translated matrix)
References translate_internal().
build translation matrix
References matrix4(), cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().
Referenced by projection_look_at().
matrix4 cpe::matrix4::transposed | ( | ) | const |
|
static |
build zero matrix
References matrix4().
Referenced by operator*().
|
private |
internal storage of the matrix
Referenced by matrix4(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), pointer(), pointer_unprotected(), product_compontentwise(), product_compontentwise_internal(), to_vector(), translate_internal(), and transposed().