Vector3D Class Reference

3D Vector. More...

#include <vector.h>

List of all members.

Public Member Functions

 Vector3D (float X=0.0f, float Y=0.0f, float Z=0.0f)
 Constructs a vector object from given components.
 Vector3D (const Vector4D &v)
 Constructs a 2D vector fromthe first 3 components of a 4D vector.
Vector3D operator+ (const Vector3D &v) const
 Adds wto vectors.
Vector3D operator- (const Vector3D &v) const
 Subtracts two vectors.
Vector3D operator * (const float f) const
 Multiplies the vector with a scalar.
const float * toFloatPointer (void) const
 Allows accessing the components via index.
float lengthSq (void) const
 Returns the quared vector length.
Vector3D normalize (void) const
 Returns a vector with the same direction, but length 1.0.
float dotProduct (const Vector3D &v) const
 Calculates the dot product.
Vector3D crossProduct (const Vector3D &v) const
 Caculates the corss procut this x v.
Vector3D absolute (void) const
 Returns the vector with the absolute of each component.
float absoluteCoordMaximum (void) const
 Returns the maximum of the absolute of each component.

Public Attributes

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


Detailed Description

3D Vector.

A vector class with self-explaining members.


Constructor & Destructor Documentation

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

Constructs a 2D vector fromthe first 3 components of a 4D vector.


Member Function Documentation

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

Adds wto vectors.

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

Subtracts two vectors.

Returns:
this - v.

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

Multiplies the vector with a scalar.

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

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

Allows accessing the components via index.

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

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

Returns the quared vector length.

Vector3D Vector3D::normalize ( void   )  const [inline]

Returns a vector with the same direction, but length 1.0.

If this is called on a Null-Vector, a Null-Vector is returned.

float Vector3D::dotProduct ( const Vector3D v  )  const [inline]

Calculates the dot product.

Parameters:
v Seconds vector.

Vector3D Vector3D::crossProduct ( const Vector3D v  )  const [inline]

Caculates the corss procut this x v.

Parameters:
v Second vector.
Returns:
This x V.


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