phoenix::PhVector2d Class Reference

2D Vector class More...

#include <PhVector2d.h>

List of all members.

Public Member Functions

 PhVector2d ()
 Constructor.
 PhVector2d (float a, float b)
 Constructor.
float getX ()
 Get X component.
float getY ()
 Get Y component.
void setX (float a)
 Set X component.
void setY (float a)
 Set Y component.
float normalize ()
 Normalization.
float getMagnitude ()
 Magnitude.
float getMagnitudeSquared ()
 Magnitude squared.
PhVector2d project (PhVector2d b)
 Projection.
PhVector2d direction (void)
 Direction.
PhVector2drotate (float angle)
 Rotate.
float getAngle (const PhVector2d &xE=PhVector2d(1.0f, 0))
 Get angle.
float operator^ (const PhVector2d &V) const
 Cross product.
float operator * (const PhVector2d &V) const
 Dot product.


Detailed Description

2D Vector class

Provides a fast and efficient way to do vector math.

Note:
Only the ambigious operators are documented, the others (such as +, -, +=, etc.) are considered obvious and therefore not documented.

Constructor & Destructor Documentation

phoenix::PhVector2d::PhVector2d (  )  [inline]

Constructor.

Basic constructor, creates a zero-length vector <0,0>.

phoenix::PhVector2d::PhVector2d ( float  a,
float  b 
)

Constructor.

Creates a vector with the given rectangular coordinates.

Parameters:
a The X component of the vector.
b The Y component of the vector.


Member Function Documentation

float phoenix::PhVector2d::getX (  ) 

Get X component.

Returns:
The X component of the vector.
See also:
setX()

float phoenix::PhVector2d::getY (  ) 

Get Y component.

Returns:
The Y component of the vector.
See also:
setY()

void phoenix::PhVector2d::setX ( float  a  ) 

Set X component.

Parameters:
a The X component of the vector.
See also:
getX()

void phoenix::PhVector2d::setY ( float  a  ) 

Set Y component.

Parameters:
a The Y component of the vector.
See also:
getY()

float phoenix::PhVector2d::normalize (  ) 

Normalization.

Normalizes the vector, as in turns in into a unit-length vector.

Returns:
The length of the vector before normalization.

float phoenix::PhVector2d::getMagnitude (  ) 

Magnitude.

Returns:
The magnitude (length) of the vector.
See also:
getManitudeSquared();

float phoenix::PhVector2d::getMagnitudeSquared (  ) 

Magnitude squared.

This is much faster than the above because it does not bother to take the square root.

Returns:
The squared magnitude (length) of the vector.
See also:
getMagnitude();

PhVector2d phoenix::PhVector2d::project ( PhVector2d  b  ) 

Projection.

Projects this vector onto vector b.

Parameters:
b Vector to project this vector onto
Returns:
The product of projection.

PhVector2d phoenix::PhVector2d::direction ( void   ) 

Direction.

Returns:
A unit-length (normalized) vector with the same angle measure as this one.

PhVector2d& phoenix::PhVector2d::rotate ( float  angle  ) 

Rotate.

Rotates the vector the desired amount.

Parameters:
angle The measure of the angle in radians.
Returns:
The rotated vector. Note that this vector itself is also rotated.

float phoenix::PhVector2d::getAngle ( const PhVector2d xE = PhVector2d(1.0f, 0)  ) 

Get angle.

Get the angle measure of the vector relative to the reference vector given. By defualt this is <1,0> but it can be changed.

Parameters:
xE The reference vector, by defualt this is <1,0>
Returns:
The angle between the reference vector and this vector.

float phoenix::PhVector2d::operator^ ( const PhVector2d V  )  const

Cross product.

Returns the cross product of the vector.

Returns:
The cross product.

float phoenix::PhVector2d::operator * ( const PhVector2d V  )  const

Dot product.

Returns the dot product.

Returns:
The dot product.


The documentation for this class was generated from the following file:
Generated on Tue Nov 20 21:59:25 2007 for Phoenix by  doxygen 1.5.4