Matrix 4x4. More...
Public Member Functions | |
matrix4 () | |
empty constructor (identity) More... | |
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 More... | |
matrix4 (const matrix3 &m) | |
direct constructor from matrix 3 More... | |
const double & | operator() (const size_t &k1, const size_t &k2) const |
Access to the k_th entry (k in [0,3]) More... | |
double & | operator() (const size_t &k1, const size_t &k2) |
Access to the k_th entry (k in [0,3]) More... | |
const double * | pointer () const |
fast pointer access More... | |
double * | pointer_unprotected () |
fast pointer access More... | |
matrix4 | operator+ (const matrix4 &m2) const |
| |
matrix4 | operator+ (const double &s) const |
| |
matrix4 | operator- (const matrix4 &m2) const |
| |
matrix4 | operator- (const double &s) const |
| |
matrix4 | operator* (const double &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/ (const double &s) const |
divide by a scalar operator More... | |
matrix4 & | operator+= (const matrix4 &m) |
internal + More... | |
matrix4 & | operator+= (const double &s) |
internal + More... | |
matrix4 & | operator-= (const matrix4 &m) |
internal - More... | |
matrix4 & | operator-= (const double &s) |
internal - More... | |
matrix4 & | operator*= (const double &s) |
internal * More... | |
matrix4 & | operator/= (const double &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< double > | to_vector () const |
convert 4x4 matrix into a 16 vector of double (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, const double &angle) |
build rotation matrix More... | |
static matrix4 | scale (const double &s) |
build scaling matrix More... | |
static matrix4 | scale (const double &s_x, const double &s_y, const double &s_z, const double &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 (const double &fovy, const double &aspect, const double &z_near, const double &z_far) |
build a perspective projection similar to gluPerspective More... | |
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 More... | |
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 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 | |
double | 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 | ( | 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.
|
private |
assert that a size_t belongs to [[0,3]]
Referenced by operator()().
|
static |
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.
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.
matrix4 cpe::matrix4::operator* | ( | const double & | 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, cpe::vec3::x(), cpe::vec3::y(), and cpe::vec3::z().
matrix mulitplication
References m, pointer_unprotected(), and zeros().
matrix4 cpe::matrix4::operator+ | ( | const double & | s | ) | const |
matrix4 cpe::matrix4::operator- | ( | const double & | s | ) | const |
matrix4 cpe::matrix4::operator- | ( | ) | const |
matrix4 cpe::matrix4::operator/ | ( | const double & | s | ) | const |
const double * cpe::matrix4::pointer | ( | ) | const |
fast pointer access
References m.
Referenced by cpe::operator*(), operator+(), cpe::operator+(), cpe::operator-(), and cpe::operator<<().
double * 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 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 matrix4().
|
static |
build a perspective projection similar to gluPerspective
double | fovy: in radian see: http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml |
References matrix4().
build rotation matrix
References matrix4(), and cpe::vec3::normalized().
|
static |
|
static |
std::vector< double > cpe::matrix4::to_vector | ( | ) | const |
convert 4x4 matrix into a 16 vector of double (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().