Main Page | Class Hierarchy | Class List | File List | Class Members

vuVector Class Reference

Taken from vuVolume2. A class for representing 3d vectors. More...

#include <vuVector.h>

List of all members.

Public Member Functions

 vuVector ()
 Default constructor making a zero vector.
 vuVector (const vuVector &v)
 Copy constructor.
 vuVector (double v1, double v2, double v3)
 Constructor initializing to a 3d vector in homogenous space.
 vuVector (double v1, double v2, double v3, double v4)
 Constructor initializing to a homogenous 3d vector.
 vuVector (double v)
 Constructor initializing the x,y,z coordinates to v.
 vuVector (const double *v)
 Constructor initializing the vector from an array of doubles.
 ~vuVector ()
 The destructor.
vuVectoroperator= (const vuVector &v)
 The assignment operator.
vuVectoroperator= (double v)
 Assigns the value v to the x,y,z elements of the vector.
vuVectoroperator= (const double *v)
 Assigns a 3d double array to the vector.
double norm (void) const
 Computes the 2-norm on the vector (lenght operator).
double norm2 (void) const
 Computes squared 2-norm (scalar product with itself).
vuVectormakeUnit (void)
 Normalizes the vector to a length of 1.
vuVectornormalize (void)
 Normalizes the vector in homogenous space.
vuVector inv (void) const
 Returns the entry-wise inverse of the vector.
vuVectorinvEq (void)
 Inverts the vector entry-wise.
vuVector mul (const vuVector &rhs) const
 Returns the entry-wise product of the vector with another vector.
vuVectormulEq (const vuVector &rhs)
 Multiplies the vector, entry-wise, by another vector.
vuVector div (const vuVector &rhs) const
 Returns the entry-wise division of the vector by another vector.
vuVectordivEq (const vuVector &rhs)
 Divides the vector, entry-wise, by another vector.
double & operator[] (dword index)
 The access operator.
const double & operator[] (dword index) const
 The const access operator.
double * getData (void)
 Returns the data pointer.
double const * getData (void) const
 const version of getData()
double dot (const vuVector &v) const
 Returns the dot product of the vector with another vector.
vuVector cross (const vuVector &v) const
vuVector operator+ (const vuVector &v) const
 Returns the sum of the vector with another vector.
vuVector operator- (const vuVector &v) const
 Returns the difference of the vector from another vector.
vuVector operator * (const vuMatrix &m) const
 Returns the product of the vector and a matrix.
vuMatrix operator * (const vuVector &v) const
 Returns the product of the vector with another vector.
vuVector operator * (double s) const
 Returns the product of the vector with a scalar.
vuVector operator/ (double s) const
 Returns the fraction of the vector with a scalar.
vuVectoroperator+= (const vuVector &v)
 Adds a vector to this vector.
vuVectoroperator-= (const vuVector &v)
 Subtracts a vector from this vector.
vuVectoroperator *= (const vuMatrix &m)
 Multiplies the vector by a matrix.
vuVectoroperator *= (double s)
 Multiplies the vector by a scalar.
bool operator== (const vuVector &v) const
 An equality operator, comparing only the x,y,z coordinates.
bool operator!= (const vuVector &v) const
 An inequality operator, comparing only the x,y,z coordinates.
int getDominantAxis () const
 Returns index of component with highest absolute.

Friends

class vuMatrix
double dot (const vuVector &v1, const vuVector &v2)
 Returns the dot product of two vectors.
vuVector cross (const vuVector &v1, const vuVector &v2)
const vuVector operator * (double s, const vuVector &v)
 Returns the product of a scalar with a vector.
std::ostream & operator<< (std::ostream &out, const vuVector &v)
 writes the foure elements to a stream; separated by whitespaces
std::istream & operator>> (std::istream &in, vuVector &v)
 reads a vector from a stream


Detailed Description

Taken from vuVolume2. A class for representing 3d vectors.

The vuVector class is a 3D homogeneous vector that works in conjunction with the vuMatrix class (a 4x4 matrix). The elements of the vuVector are all single precision floating- point numbers.


Constructor & Destructor Documentation

vuVector::vuVector const double *  v  ) 
 

Constructor initializing the vector from an array of doubles.

Parameters:
v An array of 3 doubleing point values corresponding to x,y,z.


Member Function Documentation

vuVector vuVector::cross const vuVector v  )  const
 

Returns the (LH) cross product of the vector with another vector. Left-handed means use left hand and the correspondence is this-thumb, v-pointing finger, result-middle finger

double * vuVector::getData void   ) 
 

Returns the data pointer.

The data is stored as a four dimensional double array. The getData() function can both retrieve and modify; it is similar to the [] operator. To warrant the return of a const pointer (for use in other const member functions) explicitly cast the pointer returned to (const).

vuVector vuVector::inv void   )  const
 

Returns the entry-wise inverse of the vector.

Entry wise meaning that each of the x, y, z coordinates is treated separately, leaving the fourth w coordinate untouched.

vuVector & vuVector::makeUnit void   ) 
 

Normalizes the vector to a length of 1.

This makes a unit vector which points in the same direction as the instance.

vuVector & vuVector::normalize void   ) 
 

Normalizes the vector in homogenous space.

Divides the whole vector by the 4th coordinate to make it 1.


Friends And Related Function Documentation

vuVector cross const vuVector v1,
const vuVector v2
[friend]
 

Returns the (LH) cross product of two vectors. Left-handed means use left hand and the correspondence is v1-thumb, v2-pointing finger, result-middle finger


The documentation for this class was generated from the following files:
Generated on Thu Apr 13 04:55:57 2006 by  doxygen 1.4.4