NAMD
|
4x4 matrix class with numerous operators, conversions, etc. More...
#include <Matrix4.h>
Public Member Functions | |
Matrix4 (void) | |
identity constructor More... | |
Matrix4 (double f) | |
const elements constructor More... | |
Matrix4 (const double *m) | |
construct from double array More... | |
Matrix4 (const Matrix4 &m) | |
copy constructor More... | |
~Matrix4 (void) | |
destructor More... | |
void | multpoint3d (const double[3], double[3]) const |
multiplies a 3D point (first arg) by the Matrix, returns in second arg More... | |
void | multnorm3d (const double[3], double[3]) const |
multiplies a 3D norm (first arg) by the Matrix, returns in second arg More... | |
void | multpoint4d (const double[4], double[4]) const |
multiplies a 4D point (first arg) by the Matrix, returns in second arg More... | |
void | identity (void) |
clears the matrix (resets it to identity) More... | |
void | constant (double) |
sets the matrix so all items are the given constant value More... | |
int | inverse (void) |
void | transpose (void) |
transposes the matrix More... | |
void | loadmatrix (const Matrix4 &m) |
replaces this matrix with the given one More... | |
Matrix4 & | operator= (const Matrix4 &m) |
void | multmatrix (const Matrix4 &) |
premultiply the matrix by the given matrix, this->other * this More... | |
void | rot (double, char) |
performs a left-handed rotation around an axis (char == 'x', 'y', or 'z') More... | |
void | rotate_axis (const double axis[3], double angle) |
apply a rotation around the given vector; angle in radians. More... | |
void | transvec (double x, double y, double z) |
apply a rotation such that 'x' is brought along the given vector. More... | |
void | transvecinv (double x, double y, double z) |
apply a rotation such that the given vector is brought along 'x'. More... | |
void | translate (double, double, double) |
performs a translation More... | |
void | translate (double d[3]) |
void | scale (double, double, double) |
performs scaling More... | |
void | scale (double f) |
void | window (double, double, double, double, double, double) |
sets this matrix to represent a window perspective More... | |
void | ortho (double, double, double, double, double, double) |
sets this matrix to a 3D orthographic matrix More... | |
void | ortho2 (double, double, double, double) |
sets this matrix to a 2D orthographic matrix More... | |
void | lookat (double, double, double, double, double, double, short) |
Public Attributes | |
double | mat [16] |
the matrix itself More... | |
4x4 matrix class with numerous operators, conversions, etc.
|
inline |
|
inline |
Matrix4::Matrix4 | ( | const double * | m | ) |
|
inline |
void Matrix4::constant | ( | double | f | ) |
void Matrix4::identity | ( | void | ) |
int Matrix4::inverse | ( | void | ) |
void Matrix4::loadmatrix | ( | const Matrix4 & | m | ) |
replaces this matrix with the given one
Definition at line 194 of file Matrix4.C.
References mat.
Referenced by Matrix4(), and operator=().
void Matrix4::lookat | ( | double | vx, |
double | vy, | ||
double | vz, | ||
double | px, | ||
double | py, | ||
double | pz, | ||
short | twist | ||
) |
This subroutine defines a viewing transformation with the eye at point (vx,vy,vz) looking at the point (px,py,pz). Twist is the right-hand rotation about this line. The resultant matrix is multiplied with the top of the transformation stack and then replaces it. Precisely, lookat does: lookat=trans(-vx,-vy,-vz)*rotate(theta,y)*rotate(phi,x)*rotate(-twist,z)
Definition at line 336 of file Matrix4.C.
References constant(), mat, multmatrix(), rot(), and translate().
void Matrix4::multmatrix | ( | const Matrix4 & | m | ) |
void Matrix4::multnorm3d | ( | const double | onorm[3], |
double | nnorm[3] | ||
) | const |
void Matrix4::multpoint3d | ( | const double | opoint[3], |
double | npoint[3] | ||
) | const |
void Matrix4::multpoint4d | ( | const double | opoint[4], |
double | npoint[4] | ||
) | const |
Definition at line 61 of file Matrix4.h.
References loadmatrix().
void Matrix4::ortho | ( | double | left, |
double | right, | ||
double | bottom, | ||
double | top, | ||
double | nearval, | ||
double | farval | ||
) |
sets this matrix to a 3D orthographic matrix
Definition at line 303 of file Matrix4.C.
References constant(), and mat.
void Matrix4::ortho2 | ( | double | left, |
double | right, | ||
double | bottom, | ||
double | top | ||
) |
sets this matrix to a 2D orthographic matrix
Definition at line 318 of file Matrix4.C.
References constant(), and mat.
void Matrix4::rot | ( | double | a, |
char | axis | ||
) |
performs a left-handed rotation around an axis (char == 'x', 'y', or 'z')
Definition at line 215 of file Matrix4.C.
References DEGTORAD, mat, and multmatrix().
Referenced by lookat(), rotate_axis(), transvec(), and transvecinv().
void Matrix4::rotate_axis | ( | const double | axis[3], |
double | angle | ||
) |
apply a rotation around the given vector; angle in radians.
Definition at line 245 of file Matrix4.C.
References RADTODEG, rot(), transvec(), and transvecinv().
Referenced by obj_transabout().
void Matrix4::scale | ( | double | x, |
double | y, | ||
double | z | ||
) |
performs scaling
Definition at line 279 of file Matrix4.C.
References mat, and multmatrix().
|
inline |
void Matrix4::translate | ( | double | x, |
double | y, | ||
double | z | ||
) |
performs a translation
Definition at line 270 of file Matrix4.C.
References mat, and multmatrix().
Referenced by lookat().
|
inline |
Definition at line 80 of file Matrix4.h.
References translate().
Referenced by translate().
void Matrix4::transpose | ( | void | ) |
void Matrix4::transvec | ( | double | x, |
double | y, | ||
double | z | ||
) |
apply a rotation such that 'x' is brought along the given vector.
Definition at line 252 of file Matrix4.C.
References RADTODEG, and rot().
Referenced by obj_transvec(), and rotate_axis().
void Matrix4::transvecinv | ( | double | x, |
double | y, | ||
double | z | ||
) |
apply a rotation such that the given vector is brought along 'x'.
Definition at line 261 of file Matrix4.C.
References RADTODEG, and rot().
Referenced by obj_transvecinv(), and rotate_axis().
void Matrix4::window | ( | double | left, |
double | right, | ||
double | bottom, | ||
double | top, | ||
double | nearval, | ||
double | farval | ||
) |
sets this matrix to represent a window perspective
Definition at line 288 of file Matrix4.C.
References constant(), and mat.
double Matrix4::mat[16] |
the matrix itself
Definition at line 33 of file Matrix4.h.
Referenced by constant(), identity(), inverse(), loadmatrix(), lookat(), Matrix4(), multmatrix(), multnorm3d(), multpoint3d(), multpoint4d(), obj_transabout(), obj_transvec(), obj_transvecinv(), ortho(), ortho2(), print_Matrix4(), rot(), scale(), trans_from_rotate(), translate(), transpose(), and window().