Next: Scene
Up: Display objects
Previous: Displayable
Contents
Subsections
Matrix4
Files: |
Matrix4.h,
Matrix4.C |
Derived from: |
none |
Global instance (if any): |
none |
Used in optional component: |
Part of main VMD code |
A 4 by 4 matrix of floats, used primarily for the transformation matrix of
Displayable and DisplayDevice objects. Along with general
routines to rotate, translate, and scale the matrix, this also contains
overloaded operators for = (copy, either a matrix or a scalar), *=
(multiply, by either a matrix or a scalar), and += (add a matrix).
There are many functions in this class to simply add or multiply the
matrix, to take the inverse of the matrix, or to apply rotations,
translations, etc. Most importantly, functions exist to take a 3- or
4-vector, and multiply (transform) it by this matrix.
- Matrix4::Matrix4(void) - creates a 4 by 4 identity matrix.
- Matrix4::Matrix4(float) - creates a 4 by 4 matrix with
all elements set to the given constant.
- Matrix4::Matrix4(float *) - creates a 4 by 4 matrix, copying
the given array of 16 floats into the matrix (in row-major format).
- Matrix4::Matrix4(const Matrix&) - creates a 4 by 4 matrix identical to the matrix given.
- float mat[4][4] - the matrix data itself.
The many functions in this class are not listed here. The most common use
of this is to maintain a transformation matrix for transforming 3D vectors
from one coordinate space to another, i.e. to rotate, translate, and
scale them. Once a 4 by 4 matrix `M' has been set up, then a vector `V'
is tranformed and placed in the view vector `VT' as:
M.multpoint3d(V, VT)
Next: Scene
Up: Display objects
Previous: Displayable
Contents
vmd@ks.uiuc.edu