vhdVector4 Class Reference

#include <vhdVector4.h>

List of all members.

Public Member Functions

 vhdVector4 ()
 vhdVector4 (vhtReal fX, vhtReal fY, vhtReal fZ, vhtReal fW)
 vhdVector4 (vhtReal afCoordinate[4])
 vhdVector4 (int afCoordinate[4])
 vhdVector4 (const vhtReal *const r)
 vhdVector4 (const vhdVector4 &rkVector)
vhtReal get (unsigned int index) const
void set (unsigned int index, vhtReal value)
vhtReal operator[] (unsigned int index) const
 operator vhtReal * ()
 operator const vhtReal * () const
vhdVector4 operator+ (const vhdVector4 &rkVector) const
vhdVector4 operator- (const vhdVector4 &rkVector) const
vhdVector4 operator * (vhtReal fScalar) const
vhdVector4 operator * (const vhdVector4 &rhs) const
vhdVector4 operator/ (vhtReal fScalar) const
vhdVector4 operator/ (const vhdVector4 &rhs) const
vhdVector4 operator- () const
void operator+= (const vhdVector4 &rkVector)
void operator-= (const vhdVector4 &rkVector)
void operator *= (const vhdVector4 &rkVector)
void operator/= (const vhdVector4 &rkVector)
void operator *= (vhtReal fScalar)
void operator/= (vhtReal fScalar)
vhdVector4operator= (const vhdVector4 &rkVector)
bool operator== (const vhdVector4 &rkVector) const
bool operator!= (const vhdVector4 &rkVector) const
vhdVector4operator= (const vhdVector3 &rhs)
vhtReal length () const
vhtReal squaredLength () const
vhtReal dotProduct (const vhdVector4 &vec) const
vhdVector4normalise ()

Public Attributes

vhtReal x
vhtReal y
vhtReal z
vhtReal w

Friends

vhdVector4 operator * (vhtReal fScalar, const vhdVector4 &rkVector)
std::ostream & operator<< (std::ostream &o, const vhdVector4 &v)


Constructor & Destructor Documentation

vhdVector4::vhdVector4 (  )  [inline]

vhdVector4::vhdVector4 ( vhtReal  fX,
vhtReal  fY,
vhtReal  fZ,
vhtReal  fW 
) [inline]

vhdVector4::vhdVector4 ( vhtReal  afCoordinate[4]  )  [inline]

vhdVector4::vhdVector4 ( int  afCoordinate[4]  )  [inline]

vhdVector4::vhdVector4 ( const vhtReal *const  r  )  [inline]

vhdVector4::vhdVector4 ( const vhdVector4 rkVector  )  [inline]


Member Function Documentation

vhtReal vhdVector4::get ( unsigned int  index  )  const [inline]

void vhdVector4::set ( unsigned int  index,
vhtReal  value 
) [inline]

vhtReal vhdVector4::operator[] ( unsigned int  index  )  const [inline]

vhdVector4::operator vhtReal * (  )  [inline]

Cast operator for vhtReal*.

vhdVector4::operator const vhtReal * (  )  const [inline]

Cast operator for const vhtReal*.

vhdVector4 vhdVector4::operator+ ( const vhdVector4 rkVector  )  const [inline]

vhdVector4 vhdVector4::operator- ( const vhdVector4 rkVector  )  const [inline]

vhdVector4 vhdVector4::operator * ( vhtReal  fScalar  )  const [inline]

vhdVector4 vhdVector4::operator * ( const vhdVector4 rhs  )  const [inline]

vhdVector4 vhdVector4::operator/ ( vhtReal  fScalar  )  const [inline]

vhdVector4 vhdVector4::operator/ ( const vhdVector4 rhs  )  const [inline]

Returns the result of dividing this vector by the given vector.

vhdVector4 vhdVector4::operator- (  )  const [inline]

void vhdVector4::operator+= ( const vhdVector4 rkVector  )  [inline]

void vhdVector4::operator-= ( const vhdVector4 rkVector  )  [inline]

void vhdVector4::operator *= ( const vhdVector4 rkVector  )  [inline]

void vhdVector4::operator/= ( const vhdVector4 rkVector  )  [inline]

void vhdVector4::operator *= ( vhtReal  fScalar  )  [inline]

void vhdVector4::operator/= ( vhtReal  fScalar  )  [inline]

vhdVector4 & vhdVector4::operator= ( const vhdVector4 rkVector  )  [inline]

Assigns the value of the other vector.

Parameters:
rkVector The other vector

bool vhdVector4::operator== ( const vhdVector4 rkVector  )  const [inline]

bool vhdVector4::operator!= ( const vhdVector4 rkVector  )  const [inline]

vhdVector4 & vhdVector4::operator= ( const vhdVector3 rhs  )  [inline]

vhtReal vhdVector4::length (  )  const [inline]

Returns the length (magnitude) of the vector.

Warning:
This operation requires a square root and is expensive in terms of CPU operations. If you don't need to know the exact length (e.g. for just comparing lengths) use squaredLength() instead.

vhtReal vhdVector4::squaredLength (  )  const [inline]

Returns the square of the length(magnitude) of the vector.

Remarks:
This method is for efficiency - calculating the actual length of a vector requires a square root, which is expensive in terms of the operations required. This method returns the square of the length of the vector, i.e. the same as the length but before the square root is taken. Use this if you want to find the longest / shortest vector without incurring the square root.

vhtReal vhdVector4::dotProduct ( const vhdVector4 vec  )  const [inline]

Calculates the dot (scalar) product of this vector with another.

Remarks:
The dot product can be used to calculate the angle between 2 vectors. If both are unit vectors, the dot product is the cosine of the angle; otherwise the dot product must be divided by the product of the lengths of both vectors to get the cosine of the angle. This result can further be used to calculate the distance of a point from a plane.
Parameters:
vec Vector with which to calculate the dot product (together with this one).
Returns:
A float representing the dot product value.

vhdVector4 & vhdVector4::normalise (  )  [inline]

Normalises the vector.

Remarks:
This method normalises the vector such that it's length / magnitude is 1. The result is called a unit vector.
Note:
This function will not crash for zero-sized vectors, but there will be no changes made to their components.


Friends And Related Function Documentation

vhdVector4 operator * ( vhtReal  fScalar,
const vhdVector4 rkVector 
) [friend]

std::ostream& operator<< ( std::ostream &  o,
const vhdVector4 v 
) [friend]


Member Data Documentation

vhtReal vhdVector4::x

vhtReal vhdVector4::y

vhtReal vhdVector4::z

vhtReal vhdVector4::w


Generated on Thu Jan 18 10:06:27 2007 for vhdPLUS by  doxygen 1.5.1-p1