Vector4D Class Reference

4D Vector. More...

#include <vector.h>

List of all members.

Public Member Functions

 Vector4D (void)
 Constructs a 4D verctor with all components set to zero.
 Vector4D (float X, float Y, float Z, float W)
 Constructs a 3D vector from given component values.
 Vector4D (const float *xyzw)
 Constructs a 4D vector from a given float[4] array.
int operator== (const Vector4D &v) const
 Tests wether two vectors are equal.
int operator!= (const Vector4D &v) const
 Tests wether two vectors are different.
Vector4D operator- (void) const
 Returns the vector in reverse direction with same length.
Vector4D operator+ (const Vector4D &v) const
 Returns the sum of two vectors.
Vector4D operator- (const Vector4D &v) const
 Subtracts two vectors.
Vector4D operator * (const float f) const
 Multiplies the vector with a scalar.
float operator * (const Vector4D &v) const
 Computes the dot product between the two vectors.
const float * toFloatPointer (void) const
 Allows accessing the components via index.
Vector4D modulate (const Vector4D &v) const
 Multiplies the i-th componenent of *this with the i-th component of v.
float lengthSq (void) const
 Returnes the squared length of the vector.
void colorNormalize (void)
 Clamps each component to the range [0,1].

Public Attributes

float x
 X component.
float y
 Y component.
float z
 Z component.
float w
 W component.


Detailed Description

4D Vector.

A vector class with self-explaining members.


Member Function Documentation

int Vector4D::operator== ( const Vector4D v  )  const [inline]

Tests wether two vectors are equal.

int Vector4D::operator!= ( const Vector4D v  )  const [inline]

Tests wether two vectors are different.

Vector4D Vector4D::operator- ( void   )  const [inline]

Returns the vector in reverse direction with same length.

Vector4D Vector4D::operator+ ( const Vector4D v  )  const [inline]

Returns the sum of two vectors.

Vector4D Vector4D::operator- ( const Vector4D v  )  const [inline]

Subtracts two vectors.

Returns:
this - v.

Vector4D Vector4D::operator * ( const float  f  )  const [inline]

Multiplies the vector with a scalar.

Parameters:
f Scaling factor.
Returns:
The scaled vector.

float Vector4D::operator * ( const Vector4D v  )  const [inline]

Computes the dot product between the two vectors.

const float* Vector4D::toFloatPointer ( void   )  const [inline]

Allows accessing the components via index.

Precondition:
Assumes the compiler places x,y,z,w in this sequence without padding.

Vector4D Vector4D::modulate ( const Vector4D v  )  const [inline]

Multiplies the i-th componenent of *this with the i-th component of v.

float Vector4D::lengthSq ( void   )  const [inline]

Returnes the squared length of the vector.

void Vector4D::colorNormalize ( void   )  [inline]

Clamps each component to the range [0,1].


The documentation for this class was generated from the following file:
Generated on Sun Mar 2 17:12:32 2008 for Shader Maker by  doxygen 1.5.4