#include <Vector.h>
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. |
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.
|
|
|
Initalizes this vector using rectangular coordinates.
|
|
Adds a scalar value to the magnitude of this vector.
|
|
Vector addition. This is equivalent to operator+=. |
|
Adds the x and y components of this vector to the Rect. This has the effect of "moving" the Rect. |
|
Adds the x and y components of this vector to the Point. This has the effect of "moving" the point. |
|
Clips the magnitude to the given maximum value.
|
|
Returns the magnitude of this vector.
|
|
Returns the x component of this vector.
|
|
Returns the y component of this vector.
|
|
Returns the angle counterclockwise off the positive x axis.
|
|
Initalizes this vector using polar coordinates.
|
|
Initalizes this vector using rectangular coordinates. Authors: Jim Clase, Jonathan Hilliker, Jason Winnebeck |
|
Multiplies the magnitude by the given scalar.
|
|
Rotates the vector counterclockwise by the given rotation.
|
|
Sets the value of theta.
|