Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Matrix4 Class Reference

4x4 matrix class with numerous operators, conversions, etc. More...

#include <Matrix4.h>

List of all members.

Public Methods

 Matrix4 (void)
 identity constructor. More...

 Matrix4 (float f)
 const elements constructor. More...

 Matrix4 (const float *m)
 construct from float array. More...

 Matrix4 (const Matrix4 &m)
 copy constructor. More...

 ~Matrix4 (void)
 destructor. More...

void multpoint3d (const float[3], float[3]) const
 multiplies a 3D point (first arg) by the Matrix, returns in second arg. More...

void multnorm3d (const float[3], float[3]) const
 multiplies a 3D norm (first arg) by the Matrix, returns in second arg. More...

void multpoint4d (const float[4], float[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 (float)
 sets the matrix so all items are the given constant value. More...

int inverse (void)
 inverts the matrix, that is, the inverse of the rotation, the inverse of the scaling, and the opposite of the translation vector. returns 0 if there were no problems, -1 if the matrix is singular. More...

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 (float, char)
 performs a left-handed rotation around an axis (char == 'x', 'y', or 'z'). More...

void rotate_axis (const float axis[3], float angle)
 apply a rotation around the given vector; angle in radians. More...

void transvec (float x, float y, float z)
 apply a rotation such that 'x' is brought along the given vector. More...

void transvecinv (float x, float y, float z)
 apply a rotation such that the given vector is brought along 'x'. More...

void translate (float, float, float)
 performs a translation. More...

void translate (float d[3])
void scale (float, float, float)
 performs scaling. More...

void scale (float f)
void window (float, float, float, float, float, float)
 sets this matrix to represent a window perspective. More...

void ortho (float, float, float, float, float, float)
 sets this matrix to a 3D orthographic matrix. More...

void ortho2 (float, float, float, float)
 sets this matrix to a 2D orthographic matrix. More...

void lookat (float, float, float, float, float, float, short)
 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). More...


Public Attributes

float mat [16]
 the matrix itself. More...


Detailed Description

4x4 matrix class with numerous operators, conversions, etc.

Definition at line 26 of file Matrix4.h.


Constructor & Destructor Documentation

Matrix4::Matrix4 void    [inline]
 

identity constructor.

Definition at line 28 of file Matrix4.h.

References identity.

Matrix4::Matrix4 float    f [inline]
 

const elements constructor.

Definition at line 29 of file Matrix4.h.

References constant.

Matrix4::Matrix4 const float *    m
 

construct from float array.

Definition at line 30 of file Matrix4.C.

References mat.

Matrix4::Matrix4 const Matrix4 &    m [inline]
 

copy constructor.

Definition at line 31 of file Matrix4.h.

References loadmatrix.

Matrix4::~Matrix4 void    [inline]
 

destructor.

Definition at line 32 of file Matrix4.h.


Member Function Documentation

void Matrix4::constant float   
 

sets the matrix so all items are the given constant value.

Definition at line 96 of file Matrix4.C.

References mat.

Referenced by lookat, Matrix4, ortho, ortho2, and window.

void Matrix4::identity void   
 

clears the matrix (resets it to identity).

Definition at line 86 of file Matrix4.C.

References mat.

Referenced by SpaceballTracker::do_start, Timestep::get_transform_from_cell, Matrix4, measure_pbc_neighbors, Displayable::recalc_mat, FreeVRDisplayDevice::render, CaveDisplayDevice::render, Displayable::reset_transformation, SensorConfig::SensorConfig, OpenGLRenderer::set_persp, Displayable::set_rot, OpenGLRenderer::setup_initial_opengl_state, POV3DisplayDevice::trimesh, POV3DisplayDevice::tristrip, SpaceballTracker::update, VRPNTracker::update, FreeVRTracker::update, CaveTracker::update, and VMDTracker::VMDTracker.

int Matrix4::inverse void   
 

inverts the matrix, that is, the inverse of the rotation, the inverse of the scaling, and the opposite of the translation vector. returns 0 if there were no problems, -1 if the matrix is singular.

Definition at line 104 of file Matrix4.C.

References mat, and MATSWAP.

Referenced by Tool::dograb, PickModeForce::get_force, get_transform_to_orthonormal_cell, inverse, measure_pbc_neighbors, myfit3, PickModeMove::pick_molecule_move, vmd_measure_inverse, and VolumetricData::voxel_coord_from_cartesian_coord.

void Matrix4::loadmatrix const Matrix4 &    m
 

replaces this matrix with the given one.

Definition at line 188 of file Matrix4.C.

References mat.

Referenced by Matrix4, measure_pbc_neighbors, operator=, VMDTracker::orientation, and SpaceballTracker::update.

void Matrix4::lookat float   ,
float   ,
float   ,
float   ,
float   ,
float   ,
short   
 

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 330 of file Matrix4.C.

References constant, mat, multmatrix, rot, and translate.

void Matrix4::multmatrix const Matrix4 &   
 

premultiply the matrix by the given matrix, this->other * this.

Definition at line 193 of file Matrix4.C.

References mat.

Referenced by Displayable::add_rot, VolMapCreateFastEnergy::compute_frame, convert_endpoints_to_matrix, RotateTool::do_event, Tool::dograb, DisplayDevice::find_pbc_images, get_transform_to_orthonormal_cell, lookat, measure_fit, measure_pbc_neighbors, myfit3, VMDTracker::orientation, RotateTool::orientation, Displayable::recalc_mat, OpenGLRenderer::render, FreeVRDisplayDevice::render, CaveDisplayDevice::render, rot, scale, OpenGLRenderer::set_persp, translate, and SpaceballTracker::update.

void Matrix4::multnorm3d const    float[3],
float   [3]
const
 

multiplies a 3D norm (first arg) by the Matrix, returns in second arg.

Definition at line 62 of file Matrix4.C.

References mat.

Referenced by POV3DisplayDevice::trimesh, POV3DisplayDevice::tristrip, and LibTachyonDisplayDevice::tristrip.

void Matrix4::multpoint3d const    float[3],
float   [3]
const
 

multiplies a 3D point (first arg) by the Matrix, returns in second arg.

Definition at line 35 of file Matrix4.C.

References mat.

Referenced by VolMapCreateFastEnergy::compute_frame, compute_pbcminmax, PinchTool::do_event, GrabTool::do_event, Tool::dograb, PickModeForce::get_force, measure_fit, measure_move, measure_pbc_neighbors, myfit3, normal_atom_coord, GeometryMol::normal_atom_coord, PickModeCenter::pick_molecule_end, PickModeMove::pick_molecule_move, Axes::pick_move, py_align, Scene::rotate_light, Tool::target, trans_overlap, POV3DisplayDevice::trimesh, POV3DisplayDevice::tristrip, LibTachyonDisplayDevice::tristrip, Tool::tug, and VolumetricData::voxel_coord_from_cartesian_coord.

void Matrix4::multpoint4d const    float[4],
float   [4]
const
 

multiplies a 4D point (first arg) by the Matrix, returns in second arg.

Definition at line 77 of file Matrix4.C.

References mat.

Referenced by Displayable::change_center, and OpenGLRenderer::render.

Matrix4& Matrix4::operator= const Matrix4 &    m [inline]
 

Definition at line 61 of file Matrix4.h.

References loadmatrix.

void Matrix4::ortho float   ,
float   ,
float   ,
float   ,
float   ,
float   
 

sets this matrix to a 3D orthographic matrix.

Definition at line 297 of file Matrix4.C.

References constant, and mat.

void Matrix4::ortho2 float   ,
float   ,
float   ,
float   
 

sets this matrix to a 2D orthographic matrix.

Definition at line 312 of file Matrix4.C.

References constant, and mat.

void Matrix4::rot float   ,
char   
 

performs a left-handed rotation around an axis (char == 'x', 'y', or 'z').

Definition at line 209 of file Matrix4.C.

References DEGTORAD, mat, and multmatrix.

Referenced by Displayable::add_rot, convert_endpoints_to_matrix, lookat, myfit3, rotate_axis, Scene::rotate_light, Displayable::set_rot, transvec, transvec, transvecinv, transvecinv, SpaceballTracker::update, FreeVRTracker::update, and CaveTracker::update.

void Matrix4::rotate_axis const float    axis[3],
float    angle
 

apply a rotation around the given vector; angle in radians.

Definition at line 239 of file Matrix4.C.

References RADTODEG, rot, transvec, and transvecinv.

Referenced by obj_transabout.

void Matrix4::scale float    f [inline]
 

Definition at line 84 of file Matrix4.h.

References scale.

void Matrix4::scale float   ,
float   ,
float   
 

performs scaling.

Definition at line 273 of file Matrix4.C.

References mat, and multmatrix.

Referenced by Displayable::change_center, molinfo_get, Displayable::recalc_mat, scale, FileRenderer::super_scale, POV3DisplayDevice::trimesh, and POV3DisplayDevice::tristrip.

void Matrix4::translate float    d[3] [inline]
 

Definition at line 80 of file Matrix4.h.

References translate.

void Matrix4::translate float   ,
float   ,
float   
 

performs a translation.

Definition at line 264 of file Matrix4.C.

References mat, and multmatrix.

Referenced by convert_endpoints_to_matrix, get_transform_to_orthonormal_cell, Timestep::get_transforms, lookat, measure_fit, molinfo_get, myfit2, myfit3, Displayable::recalc_mat, Tool::target, and translate.

void Matrix4::transpose void   
 

transposes the matrix.

Definition at line 175 of file Matrix4.C.

References mat.

Referenced by Tool::tug.

void Matrix4::transvec float    x,
float    y,
float    z
 

apply a rotation such that 'x' is brought along the given vector.

Definition at line 246 of file Matrix4.C.

References RADTODEG, and rot.

Referenced by obj_transvec, and rotate_axis.

void Matrix4::transvecinv float    x,
float    y,
float    z
 

apply a rotation such that the given vector is brought along 'x'.

Definition at line 255 of file Matrix4.C.

References RADTODEG, and rot.

Referenced by obj_transvecinv, and rotate_axis.

void Matrix4::window float   ,
float   ,
float   ,
float   ,
float   ,
float   
 

sets this matrix to represent a window perspective.

Definition at line 282 of file Matrix4.C.

References constant, and mat.


Member Data Documentation

float Matrix4::mat[16]
 

the matrix itself.

Definition at line 33 of file Matrix4.h.

Referenced by atomselect_move, compute_pbcminmax, constant, CmdRotMat::create_text, RotateTool::do_event, PrintTool::do_event, Tool::dograb, get_rotation, Timestep::get_transform_from_cell, handle_vrpn_tracker, identity, inverse, inverse, VrmlDisplayDevice::load, OpenGLRenderer::loadmatrix, loadmatrix, lookat, Matrix4, measure_fit, measure_move, measure_pbc2onc, measure_pbc_neighbors, molinfo_get, molinfo_set, OpenGLRenderer::multmatrix, multmatrix, multnorm3d, multpoint3d, multpoint4d, obj_transabout, obj_transvec, obj_transvecinv, ortho, ortho2, print_Matrix4, py_fit, py_move, PSDisplayDevice::render, FileRenderer::render, rot, scale, text_cmd_tool, trans_from_rotate, translate, transpose, POV3DisplayDevice::trimesh, POV3DisplayDevice::tristrip, vmd_measure_fit, vmd_measure_inverse, vmd_measure_pbc2onc_transform, vmd_measure_pbc_neighbors, vmd_measure_trans_overlap, vmd_volmap_new_fromtype, and window.


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 01:28:15 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002