Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Vector Class Reference

The Vector class represents a 2D vector. More...

#include <Vector.h>

List of all members.

Public Methods

 Vector ()
 Vector (float magx2, float magy2)
 Initalizes this vector using rectangular coordinates.

void initRect (float magx2, float magy2)
 Initalizes this vector using rectangular coordinates.

void initPolar (float theta2, float mag2)
 Initalizes this vector using polar coordinates.

float getMagx () const
 Returns the x component of this vector.

float getMagy () const
 Returns the y component of this vector.

float getTheta () const
 Returns the angle counterclockwise off the positive x axis.

float getMag () const
 Returns the magnitude of this vector.

void rotate (float rotation)
 Rotates the vector counterclockwise by the given rotation.

void add (const Vector &other)
 Vector addition.

void add (float scalar)
 Adds a scalar value to the magnitude of this vector.

void clip (float max)
 Clips the magnitude to the given maximum value.

void mult (float scalar)
 Multiplies the magnitude by the given scalar.

void addTo (Point &other) const
 Adds the x and y components of this vector to the Point.

void addTo (Rect &other) const
 Adds the x and y components of this vector to the Rect.

void setTheta (float rot)
 Sets the value of theta.


Detailed Description

The Vector class represents a 2D vector.

Vectors support addition, polar and rectangular coordinates, addition to vectors, addition to Rect s and Point s. Multiplication and so on.

Note: This class like Rect and Point come from classes Jason has used in four different projects so they are well tested and understood, for this reason we decided to use them instead of the D3DX/Win32 classes/structs.


Constructor & Destructor Documentation

Vector::Vector   [inline]
 

Vector::Vector float    magx2,
float    magy2
[inline]
 

Initalizes this vector using rectangular coordinates.


Member Function Documentation

void Vector::add float    scalar
 

Adds a scalar value to the magnitude of this vector.

void Vector::add const Vector &    other
 

Vector addition.

This is equivalent to operator+=.

void Vector::addTo Rect   other const [inline]
 

Adds the x and y components of this vector to the Rect.

This has the effect of "moving" the Rect.

void Vector::addTo Point   other const [inline]
 

Adds the x and y components of this vector to the Point.

This has the effect of "moving" the point.

void Vector::clip float    max
 

Clips the magnitude to the given maximum value.

float Vector::getMag   const [inline]
 

Returns the magnitude of this vector.

float Vector::getMagx   const [inline]
 

Returns the x component of this vector.

float Vector::getMagy   const [inline]
 

Returns the y component of this vector.

float Vector::getTheta   const [inline]
 

Returns the angle counterclockwise off the positive x axis.

void Vector::initPolar float    theta2,
float    mag2
 

Initalizes this vector using polar coordinates.

void Vector::initRect float    magx2,
float    magy2
 

Initalizes this vector using rectangular coordinates.

Authors: Jim Clase, Jonathan Hilliker, Jason Winnebeck

void Vector::mult float    scalar
 

Multiplies the magnitude by the given scalar.

void Vector::rotate float    rotation
 

Rotates the vector counterclockwise by the given rotation.

void Vector::setTheta float    rot
 

Sets the value of theta.


The documentation for this class was generated from the following files:
Generated on Tue Mar 4 02:29:26 2003 for SuperIsoBomb by doxygen1.2.18