Vector Class Reference

#include <vector.h>

List of all members.


Detailed Description

Vector class.

Represents either a 3D point in space, a velocity or a force. Provides several convenient operator overloads.

Definition at line 33 of file vector.h.


Public Member Functions

 Vector ()
 Constructor.
 Vector (float x, float y, float z=0.0f)
 Constructor.
 Vector (const Vector &v)
 Copy constructor.
Vector operator* (float c) const
 Scale vector operator.
Vectoroperator*= (float c)
 In-place scale vector operator.
Vector operator/ (float c) const
 Scale vector operator.
Vectoroperator/= (float c)
 In-place scale vector operator.
Vector operator+ (const Vector &v) const
 Add vector operator.
Vectoroperator+= (const Vector &v)
 In-place add vector operator.
Vector operator- (const Vector &v) const
 Substract vector operator.
Vectoroperator-= (const Vector &v)
 In-place substract vector operator.
float length () const
 Returns the length of this vector.
float squaredLength () const
 Returns the squared length of this vector.
float manhattanLength () const
 Returns the manhattan length of this vector.
Vector normalized () const
 Returns a normalized version of this vector.

Public Attributes

float x
float y
float z

Constructor & Destructor Documentation

Vector::Vector (  )  [inline]

Constructor.

Definition at line 39 of file vector.h.

Vector::Vector ( float  x,
float  y,
float  z = 0.0f 
) [inline]

Constructor.

Definition at line 48 of file vector.h.

Vector::Vector ( const Vector v  )  [inline]

Copy constructor.

Definition at line 57 of file vector.h.


Member Function Documentation

Vector Vector::operator* ( float  c  )  const [inline]

Scale vector operator.

Definition at line 66 of file vector.h.

Vector& Vector::operator*= ( float  c  )  [inline]

In-place scale vector operator.

Definition at line 76 of file vector.h.

Vector Vector::operator/ ( float  c  )  const [inline]

Scale vector operator.

Definition at line 87 of file vector.h.

Vector& Vector::operator/= ( float  c  )  [inline]

In-place scale vector operator.

Definition at line 97 of file vector.h.

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

Add vector operator.

Definition at line 108 of file vector.h.

Vector& Vector::operator+= ( const Vector v  )  [inline]

In-place add vector operator.

Definition at line 118 of file vector.h.

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

Substract vector operator.

Definition at line 129 of file vector.h.

Vector& Vector::operator-= ( const Vector v  )  [inline]

In-place substract vector operator.

Definition at line 139 of file vector.h.

float Vector::length (  )  const [inline]

Returns the length of this vector.

This method does a relatively slow square root.

Definition at line 151 of file vector.h.

float Vector::squaredLength (  )  const [inline]

Returns the squared length of this vector.

Avoids the square root.

Definition at line 159 of file vector.h.

float Vector::manhattanLength (  )  const [inline]

Returns the manhattan length of this vector.

Definition at line 167 of file vector.h.

Vector Vector::normalized (  )  const [inline]

Returns a normalized version of this vector.

This is a unit vector running parallel to it.

Definition at line 176 of file vector.h.


Member Data Documentation

float Vector::x

Definition at line 182 of file vector.h.

float Vector::y

Definition at line 182 of file vector.h.

float Vector::z

Definition at line 182 of file vector.h.


The documentation for this class was generated from the following file:

Generated on Sun Apr 26 17:30:44 2009 for The Mana World by  doxygen 1.5.5