ARSTD::Vector4 Class Reference

List of all members.

Public Member Functions

 Vector4 ()
 Vector4 (const double &x, const double &y, const double &z, const double &w)
double getLength () const
double getSquaredLength () const
const Vector4normalize ()
Vector4 getNormalized () const

Public Attributes

double x
 The first component.
double y
 The second component.
double z
 The third component.
double w
 The fourth component.
double r
 Alias of first component.
double g
 Alias of second component.
double b
 Alias of third component.
double a
 Alias of fourth component.

Detailed Description

This class implements a 4-dimensional vector.


Constructor & Destructor Documentation

ARSTD::Vector4::Vector4 (  ) 

Default constructor. Sets all members to zero

ARSTD::Vector4::Vector4 ( const double &  x,
const double &  y,
const double &  z,
const double &  w 
)

Constructor, that initializes the members with the parameters.

Parameters:
x x-component
y y-component
z z-component
w w-component


Member Function Documentation

double ARSTD::Vector4::getLength (  )  const

Returns the length of the vector.

Returns:
length of the vector

double ARSTD::Vector4::getSquaredLength (  )  const

Returns the squared length of the vector. Because the calculation of the length of a vector needs a squareroot operation this method can be used to calc with squared values.

Returns:
Squared length of the vector.

const Vector4& ARSTD::Vector4::normalize (  ) 

Normalizes the vector to a length of 1.

Precondition:
this->length != 0.0
Postcondition:
this->length() is 1
Returns:
The normalized vector

Vector4 ARSTD::Vector4::getNormalized (  )  const

Returns the normalized version of this vector.

Precondition:
this->length != 0.0
Postcondition:
this->length() is 1
Returns:
The normalized vector


Generated at 2 Jan 2007 for project CodeSubWars. www.codesubwars.org