Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuMatrix Class Reference

The vuMatrix class is a 4x4 matrix that works in conjunction with the vuVector class (a 3D homogeneous vector). More...

#include <vuMatrix.h>

Collaboration diagram for vuMatrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuMatrix ()
 Default constructor that sets all values to 0.0f.
 vuMatrix (const vuMatrix &m)
 Copy constructor.
 vuMatrix (float v)
 Constructor that sets all values to v.
 vuMatrix (const float *v)
 Constructor that initializes the vector from a float array.
 ~vuMatrix ()
 Destructor.
vuMatrixoperator= (const vuMatrix &m)
 Assigns a matrix to the instance.
vuMatrixoperator= (float v)
 Assigns a floating point value to each entry of the matrix.
vuMatrixoperator= (const float *v)
 Assigns an array of floating point values to the matrix.
vuMatrixmakeIdentity (void)
 Makes the matrix an identity matrix and returns a reference.
vuMatrixmakeRotate (const vuVector &axis, float a)
 Makes a rotation matrix for a rotation of a degrees around the axis vector.
vuMatrixmakeRotateX (float a)
 Makes this matrix a rotation matrix for a rotation of a degrees about the x axis.
vuMatrixmakeRotateY (float a)
 Makes this matrix a rotation matrix for a rotation of a degrees about the y axis.
vuMatrixmakeRotateZ (float a)
 Makes this matrix a rotation matrix for a rotation of a degrees about the z axis.
vuMatrixmakeTranslate (float x, float y, float z)
 Makes this matrix a translation matrix corresponding to the given displacement.
vuMatrixmakeScale (float x, float y, float z)
 Makes this matrix a scaling matrix.
vuMatrixmakeShearXY (float s)
 Makes this matrix a shearing matrix in the XY plane.
vuMatrixmakeShearXZ (float s)
 Makes this matrix a shearing matrix in the XZ plane.
vuMatrixmakeShearYX (float s)
 Makes this matrix a shearing matrix in the YX plane.
vuMatrixmakeShearYZ (float s)
 Makes this matrix a shearing matrix in the YZ plane.
vuMatrixmakeShearZX (float s)
 Makes this matrix a shearing matrix in the ZX plane.
vuMatrixmakeShearZY (float s)
 Makes this matrix a shearing matrix in the ZY plane.
vuMatrixmakeReflectX (void)
 Makes this matrix a reflection matrix about the x axis.
vuMatrixmakeReflectY (void)
 Makes this matrix a reflection matrix about the y axis.
vuMatrixmakeReflectZ (void)
 Makes this matrix a reflection matrix about the z axis.
vuMatrixmakePerspective (float d)
 Makes this matrix a perspective matrix for the distance d.
vuMatrixmakePerspectiveKeepZ (float d)
 Makes this matrix a perspective matrix for the distance d, keeping the z value.
floatoperator[] (unsigned int index)
 The access operator.
const floatoperator[] (unsigned int index) const
 The const access operator.
floatgetData (void)
 Returns the data pointer.
float const * getData (void) const
 returns const data pointer
vuMatrix invOrtho () const
 Returns the transposed 3x3 matrix with negative translation.
vuMatrix operator+ (const vuMatrix &m) const
 Returns the addition of the two matrices..
vuMatrix operator- (const vuMatrix &m) const
 Returns the subtraction a matrix from the instance.
vuMatrix operator * (const vuMatrix &m) const
 Returns the product of the two matrices.
vuVector operator * (const vuVector &v) const
 Returns the product of the instance with a vector.
vuMatrix operator * (float s) const
 Returns the product of the instance with a scalar.
vuMatrixoperator+= (const vuMatrix &m)
 Adds a matrix to the instance.
vuMatrixoperator-= (const vuMatrix &m)
 Subtracts a matrix from the instance.
vuMatrixoperator *= (const vuMatrix &m)
 Multiplies the instance by a matrix.
vuMatrixoperator *= (float s)
 Multiplies the instance by a scalar.
bool operator== (const vuMatrix &m) const
 An equality operator.
bool operator!= (const vuMatrix &m) const
 An inequality operator.
vuMatrix inverse (void)
 Returns the inverse of the matrix.
void invertRotationMatrix ()
 Inverts a rotation matrix.

Private Attributes

float val [16]
 this is the buffer that stores the entries of the matrix

Friends

class vuVector
vuMatrix operator * (float s, const vuMatrix &m)
 Multiplies a scalar by a matrix.

Detailed Description

The vuMatrix class is a 4x4 matrix that works in conjunction with the vuVector class (a 3D homogeneous vector).

The elements of the vuMatrix are all single precision floating-point numbers, stored in column-major order to be compatible with OpenGL.

Definition at line 19 of file vuMatrix.h.


Constructor & Destructor Documentation

vuMatrix::vuMatrix  ) 
 

Default constructor that sets all values to 0.0f.

Definition at line 8 of file vuMatrix.cpp.

References val.

vuMatrix::vuMatrix const vuMatrix m  ) 
 

Copy constructor.

Definition at line 15 of file vuMatrix.cpp.

References val.

vuMatrix::vuMatrix float  v  ) 
 

Constructor that sets all values to v.

Definition at line 22 of file vuMatrix.cpp.

References val.

vuMatrix::vuMatrix const float v  ) 
 

Constructor that initializes the vector from a float array.

Parameters:
v An array of 16 floating point values.

Definition at line 29 of file vuMatrix.cpp.

References val.

vuMatrix::~vuMatrix  ) 
 

Destructor.

Definition at line 36 of file vuMatrix.cpp.


Member Function Documentation

float const * vuMatrix::getData void   )  const
 

returns const data pointer

Definition at line 251 of file vuMatrix.cpp.

float * vuMatrix::getData void   ) 
 

Returns the data pointer.

Same as calling operator[0].

Definition at line 246 of file vuMatrix.cpp.

Referenced by invOrtho().

vuMatrix vuMatrix::inverse void   ) 
 

Returns the inverse of the matrix.

Definition at line 387 of file vuMatrix.cpp.

References val.

Referenced by vu111211A::computeEyePoint(), vu1512119::computeEyePoint(), vu111211A::computeWarpPerspective(), and vu1512119::computeWarpPerspective().

void vuMatrix::invertRotationMatrix  ) 
 

Inverts a rotation matrix.

The inverse of a rotation matrix is simply its transpose, which takes 3 swaps

Definition at line 497 of file vuMatrix.cpp.

References swap(), and val.

Here is the call graph for this function:

vuMatrix vuMatrix::invOrtho  )  const
 

Returns the transposed 3x3 matrix with negative translation.

Definition at line 255 of file vuMatrix.cpp.

References getData(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeIdentity void   ) 
 

Makes the matrix an identity matrix and returns a reference.

Definition at line 68 of file vuMatrix.cpp.

References val.

Referenced by vu111211A::computeShearPerspective(), vu1512119::computeShearPerspective(), vu111211A::computeViewMatrix(), vu1512119::computeViewMatrix(), vu111211A::computeWarpPerspective(), vu1512119::computeWarpPerspective(), makePerspective(), makePerspectiveKeepZ(), makeReflectX(), makeReflectY(), makeReflectZ(), makeRotateX(), makeRotateY(), makeRotateZ(), makeScale(), makeShearXY(), makeShearXZ(), makeShearYX(), makeShearYZ(), makeShearZX(), makeShearZY(), and makeTranslate().

vuMatrix & vuMatrix::makePerspective float  d  ) 
 

Makes this matrix a perspective matrix for the distance d.

Definition at line 214 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makePerspectiveKeepZ float  d  ) 
 

Makes this matrix a perspective matrix for the distance d, keeping the z value.

Definition at line 222 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeReflectX void   ) 
 

Makes this matrix a reflection matrix about the x axis.

Definition at line 193 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeReflectY void   ) 
 

Makes this matrix a reflection matrix about the y axis.

Definition at line 200 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeReflectZ void   ) 
 

Makes this matrix a reflection matrix about the z axis.

Definition at line 207 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeRotate const vuVector axis,
float  a
 

Makes a rotation matrix for a rotation of a degrees around the axis vector.

Parameters:
axis The axis of rotation.
a The angle of rotation, in degrees.

Definition at line 76 of file vuMatrix.cpp.

References vuVector::mul(), PI_OVER_180, and val.

Referenced by vu111211A::computeViewMatrix(), vu1512119::computeViewMatrix(), vuCamera::rotateAboutLookAt(), vuCamera::rotateAboutRight(), vuCamera::rotateAboutUp(), Volume::rotateSliceX(), vu1112117::rotateSliceX(), Volume::rotateSliceY(), vu1112117::rotateSliceY(), Volume::rotateSliceZ(), vu1112117::rotateSliceZ(), and vuArcBall::turn().

Here is the call graph for this function:

vuMatrix & vuMatrix::makeRotateX float  a  ) 
 

Makes this matrix a rotation matrix for a rotation of a degrees about the x axis.

Definition at line 109 of file vuMatrix.cpp.

References makeIdentity(), PI_OVER_180, and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeRotateY float  a  ) 
 

Makes this matrix a rotation matrix for a rotation of a degrees about the y axis.

Definition at line 117 of file vuMatrix.cpp.

References makeIdentity(), PI_OVER_180, and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeRotateZ float  a  ) 
 

Makes this matrix a rotation matrix for a rotation of a degrees about the z axis.

Definition at line 125 of file vuMatrix.cpp.

References makeIdentity(), PI_OVER_180, and val.

Referenced by vu111211A::computeViewMatrix(), and vu1512119::computeViewMatrix().

Here is the call graph for this function:

vuMatrix & vuMatrix::makeScale float  x,
float  y,
float  z
 

Makes this matrix a scaling matrix.

Definition at line 142 of file vuMatrix.cpp.

References makeIdentity(), and val.

Referenced by vu111211A::computeWarpPerspective(), and vu1512119::computeWarpPerspective().

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearXY float  s  ) 
 

Makes this matrix a shearing matrix in the XY plane.

Definition at line 151 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearXZ float  s  ) 
 

Makes this matrix a shearing matrix in the XZ plane.

Definition at line 158 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearYX float  s  ) 
 

Makes this matrix a shearing matrix in the YX plane.

Definition at line 165 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearYZ float  s  ) 
 

Makes this matrix a shearing matrix in the YZ plane.

Definition at line 172 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearZX float  s  ) 
 

Makes this matrix a shearing matrix in the ZX plane.

Definition at line 179 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeShearZY float  s  ) 
 

Makes this matrix a shearing matrix in the ZY plane.

Definition at line 186 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix & vuMatrix::makeTranslate float  x,
float  y,
float  z
 

Makes this matrix a translation matrix corresponding to the given displacement.

Definition at line 133 of file vuMatrix.cpp.

References makeIdentity(), and val.

Here is the call graph for this function:

vuMatrix vuMatrix::operator * float  s  )  const
 

Returns the product of the instance with a scalar.

Definition at line 311 of file vuMatrix.cpp.

References val.

vuVector vuMatrix::operator * const vuVector v  )  const
 

Returns the product of the instance with a vector.

Definition at line 299 of file vuMatrix.cpp.

References val, and vuVector::val.

vuMatrix vuMatrix::operator * const vuMatrix m  )  const
 

Returns the product of the two matrices.

Definition at line 287 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator *= float  s  ) 
 

Multiplies the instance by a scalar.

Definition at line 357 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator *= const vuMatrix m  ) 
 

Multiplies the instance by a matrix.

Definition at line 345 of file vuMatrix.cpp.

References val.

bool vuMatrix::operator!= const vuMatrix m  )  const
 

An inequality operator.

Definition at line 374 of file vuMatrix.cpp.

References operator==().

Here is the call graph for this function:

vuMatrix vuMatrix::operator+ const vuMatrix m  )  const
 

Returns the addition of the two matrices..

Definition at line 269 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator+= const vuMatrix m  ) 
 

Adds a matrix to the instance.

Definition at line 329 of file vuMatrix.cpp.

References val.

vuMatrix vuMatrix::operator- const vuMatrix m  )  const
 

Returns the subtraction a matrix from the instance.

Definition at line 278 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator-= const vuMatrix m  ) 
 

Subtracts a matrix from the instance.

Definition at line 337 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator= const float v  ) 
 

Assigns an array of floating point values to the matrix.

Definition at line 60 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator= float  v  ) 
 

Assigns a floating point value to each entry of the matrix.

Definition at line 52 of file vuMatrix.cpp.

References val.

vuMatrix & vuMatrix::operator= const vuMatrix m  ) 
 

Assigns a matrix to the instance.

Definition at line 41 of file vuMatrix.cpp.

References val.

bool vuMatrix::operator== const vuMatrix m  )  const
 

An equality operator.

Definition at line 365 of file vuMatrix.cpp.

References val.

Referenced by operator!=().

const float * vuMatrix::operator[] unsigned int  index  )  const
 

The const access operator.

Definition at line 238 of file vuMatrix.cpp.

References val.

float * vuMatrix::operator[] unsigned int  index  ) 
 

The access operator.

Definition at line 230 of file vuMatrix.cpp.

References val.


Friends And Related Function Documentation

vuMatrix operator * float  s,
const vuMatrix m
[friend]
 

Multiplies a scalar by a matrix.

Definition at line 320 of file vuMatrix.cpp.

friend class vuVector [friend]
 

Definition at line 21 of file vuMatrix.h.


Member Data Documentation

float vuMatrix::val[16] [private]
 

this is the buffer that stores the entries of the matrix

Definition at line 138 of file vuMatrix.h.

Referenced by inverse(), invertRotationMatrix(), invOrtho(), makeIdentity(), makePerspective(), makePerspectiveKeepZ(), makeReflectX(), makeReflectY(), makeReflectZ(), makeRotate(), makeRotateX(), makeRotateY(), makeRotateZ(), makeScale(), makeShearXY(), makeShearXZ(), makeShearYX(), makeShearYZ(), makeShearZX(), makeShearZY(), makeTranslate(), vuVector::operator *(), operator *(), operator *(), vuVector::operator *=(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), operator[](), and vuMatrix().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:24 2004 for vuVolume by  doxygen 1.3.9.1