Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members 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 multpointarray_3d (int numpts, const float *, float *) const
multiplies a 3D point array (2nd arg) by the Matrix, returns in 3rd 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 multplaneeq3d (const float[3], float[3]) const
multiplies a 3D texture plane equation by the Matrix. 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 128 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 118 of file Matrix4.C.

References mat.

Referenced by SpaceballTracker::do_start, MobileTracker::do_start, dodecahedron, Timestep::get_transform_from_cell, Matrix4, measure_pbc_neighbors, Displayable::recalc_mat, VRJugglerDisplayDevice::render, FreeVRDisplayDevice::render, CaveDisplayDevice::render, Displayable::reset_transformation, SensorConfig::SensorConfig, OpenGLRenderer::set_persp, Displayable::set_rot, OpenGLRenderer::setup_initial_opengl_state, POV3DisplayDevice::trimesh_c4n3v3, POV3DisplayDevice::trimesh_c4u_n3b_v3f, POV3DisplayDevice::tristrip, SpaceballTracker::update, VRPNTracker::update, FreeVRTracker::update, CaveTracker::update, MobileTracker::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 136 of file Matrix4.C.

References mat, and MATSWAP.

Referenced by Tool::dograb, PickModeForce::get_force, get_transform_to_orthonormal_cell, 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 220 of file Matrix4.C.

References mat.

Referenced by Matrix4, measure_pbc_neighbors, operator=, VMDTracker::orientation, VRJugglerTracker::update, SpaceballTracker::update, and MobileTracker::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 364 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 225 of file Matrix4.C.

References mat.

Referenced by Displayable::add_rot, 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, VRJugglerDisplayDevice::render, FreeVRDisplayDevice::render, CaveDisplayDevice::render, rot, scale, OpenGLRenderer::set_persp, translate, SpaceballTracker::update, and MobileTracker::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 72 of file Matrix4.C.

References mat.

Referenced by multplaneeq3d, OptiXRenderer::render_to_videostream, OptiXRenderer::ring_array_color, HMDMgr::rot_basis_quat, HMDMgr::rot_point_quat, OSPRayRenderer::tricolor_list, OSPRay2Renderer::tricolor_list, OptiXRenderer::tricolor_list, ANARIRender::tricolor_list, POV3DisplayDevice::trimesh_c4n3v3, OSPRayRenderer::trimesh_c4n3v3, OSPRay2Renderer::trimesh_c4n3v3, OptiXRenderer::trimesh_c4n3v3, ANARIRender::trimesh_c4n3v3, POV3DisplayDevice::trimesh_c4u_n3b_v3f, OSPRayRenderer::trimesh_c4u_n3b_v3f, OSPRay2Renderer::trimesh_c4u_n3b_v3f, OptiXRenderer::trimesh_c4u_n3b_v3f, ANARIRender::trimesh_c4u_n3b_v3f, OSPRayRenderer::trimesh_c4u_n3f_v3f, OSPRay2Renderer::trimesh_c4u_n3f_v3f, OptiXRenderer::trimesh_c4u_n3f_v3f, ANARIRender::trimesh_c4u_n3f_v3f, OSPRayRenderer::trimesh_n3b_v3f, OSPRay2Renderer::trimesh_n3b_v3f, OptiXRenderer::trimesh_n3b_v3f, ANARIRender::trimesh_n3b_v3f, OSPRayRenderer::trimesh_n3f_v3f, OSPRay2Renderer::trimesh_n3f_v3f, OptiXRenderer::trimesh_n3f_v3f, ANARIRender::trimesh_n3f_v3f, POV3DisplayDevice::tristrip, OSPRayRenderer::tristrip, OSPRay2Renderer::tristrip, OptiXRenderer::tristrip, LibTachyonDisplayDevice::tristrip, and ANARIRender::tristrip.

void Matrix4::multplaneeq3d ( const float[3],
float [3]
) const

multiplies a 3D texture plane equation by the Matrix.

Definition at line 89 of file Matrix4.C.

References multnorm3d.

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 compute_pbcminmax, OSPRayRenderer::cylinder_array, OSPRay2Renderer::cylinder_array, OptiXRenderer::cylinder_array, ANARIRender::cylinder_array, OSPRayRenderer::cylinder_array_color, OSPRay2Renderer::cylinder_array_color, OptiXRenderer::cylinder_array_color, ANARIRender::cylinder_array_color, PinchTool::do_event, GrabTool::do_event, dodecahedron, Tool::dograb, PickModeForce::get_force, measure_fit, measure_move, measure_pbc_neighbors, multpointarray_3d, myfit3, normal_atom_coord, GeometryMol::normal_atom_coord, PickModeCenter::pick_molecule_end, PickModeMove::pick_molecule_move, Stage::pick_move, Axes::pick_move, OptiXRenderer::render_to_videostream, OptiXRenderer::ring_array_color, Scene::rotate_light, OSPRayRenderer::sphere_array, OSPRay2Renderer::sphere_array, OptiXRenderer::sphere_array, ANARIRender::sphere_array, OSPRayRenderer::sphere_array_color, OSPRay2Renderer::sphere_array_color, OptiXRenderer::sphere_array_color, ANARIRender::sphere_array_color, Tool::target, text_cmd_mol, trans_overlap, OSPRayRenderer::tricolor_list, OSPRay2Renderer::tricolor_list, OptiXRenderer::tricolor_list, ANARIRender::tricolor_list, POV3DisplayDevice::trimesh_c4n3v3, OSPRayRenderer::trimesh_c4n3v3, OSPRay2Renderer::trimesh_c4n3v3, OptiXRenderer::trimesh_c4n3v3, ANARIRender::trimesh_c4n3v3, POV3DisplayDevice::trimesh_c4u_n3b_v3f, OSPRayRenderer::trimesh_c4u_n3b_v3f, OSPRay2Renderer::trimesh_c4u_n3b_v3f, OptiXRenderer::trimesh_c4u_n3b_v3f, ANARIRender::trimesh_c4u_n3b_v3f, OSPRayRenderer::trimesh_c4u_n3f_v3f, OSPRay2Renderer::trimesh_c4u_n3f_v3f, OptiXRenderer::trimesh_c4u_n3f_v3f, ANARIRender::trimesh_c4u_n3f_v3f, OSPRayRenderer::trimesh_n3b_v3f, OSPRay2Renderer::trimesh_n3b_v3f, OptiXRenderer::trimesh_n3b_v3f, ANARIRender::trimesh_n3b_v3f, OSPRayRenderer::trimesh_n3f_v3f, OSPRay2Renderer::trimesh_n3f_v3f, OptiXRenderer::trimesh_n3f_v3f, ANARIRender::trimesh_n3f_v3f, OptiXRenderer::trimesh_v3f, POV3DisplayDevice::tristrip, OSPRayRenderer::tristrip, OSPRay2Renderer::tristrip, OptiXRenderer::tristrip, LibTachyonDisplayDevice::tristrip, ANARIRender::tristrip, Tool::tug, VRJugglerTracker::update, 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 109 of file Matrix4.C.

References mat.

Referenced by Displayable::change_center, and text_cmd_mol.

void Matrix4::multpointarray_3d ( int numpts,
const float * ,
float *
) const

multiplies a 3D point array (2nd arg) by the Matrix, returns in 3rd arg.

Definition at line 60 of file Matrix4.C.

References multpoint3d.

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

Definition at line 67 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 331 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 346 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 241 of file Matrix4.C.

References DEGTORAD, mat, and multmatrix.

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

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

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

Definition at line 273 of file Matrix4.C.

References RADTODEG, rot, transvec, and transvecinv.

Referenced by do_density_rotate, do_rotate, dodecahedron, obj_transabout, OptiXRenderer::render_to_videostream, Symmetry::score_axis, Symmetry::score_plane, and Symmetry::score_rotary_reflection.

void Matrix4::scale ( float f ) [inline]

Definition at line 90 of file Matrix4.h.

References scale.

void Matrix4::scale ( float ,
float ,
float
)

performs scaling.

Definition at line 307 of file Matrix4.C.

References mat, multmatrix, and z.

Referenced by Displayable::change_center, molinfo_get, Displayable::recalc_mat, scale, Symmetry::score_inversion, Symmetry::score_plane, Symmetry::score_rotary_reflection, FileRenderer::super_scale, POV3DisplayDevice::trimesh_c4n3v3, POV3DisplayDevice::trimesh_c4u_n3b_v3f, and POV3DisplayDevice::tristrip.

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

Definition at line 86 of file Matrix4.h.

References translate.

void Matrix4::translate ( float ,
float ,
float
)

performs a translation.

Definition at line 298 of file Matrix4.C.

References mat, multmatrix, and z.

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

void Matrix4::transpose ( void )

transposes the matrix.

Definition at line 207 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 280 of file Matrix4.C.

References length, RADTODEG, rot, and z.

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

References length, RADTODEG, rot, and z.

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

References constant, and mat.


Member Data Documentation

float Matrix4::mat[16]

The documentation for this class was generated from the following files:
Generated on Mon Nov 17 02:48:47 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /