#include <PhVector2d.h>
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. | |
| PhVector2d & | rotate (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. | |
Provides a fast and efficient way to do vector math.
| 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.
| a | The X component of the vector. | |
| b | The Y component of the vector. |
| float phoenix::PhVector2d::getX | ( | ) |
| float phoenix::PhVector2d::getY | ( | ) |
| void phoenix::PhVector2d::setX | ( | float | a | ) |
| void phoenix::PhVector2d::setY | ( | float | a | ) |
| float phoenix::PhVector2d::normalize | ( | ) |
Normalization.
Normalizes the vector, as in turns in into a unit-length vector.
| float phoenix::PhVector2d::getMagnitude | ( | ) |
Magnitude.
| float phoenix::PhVector2d::getMagnitudeSquared | ( | ) |
Magnitude squared.
This is much faster than the above because it does not bother to take the square root.
| PhVector2d phoenix::PhVector2d::project | ( | PhVector2d | b | ) |
Projection.
Projects this vector onto vector b.
| b | Vector to project this vector onto |
| PhVector2d phoenix::PhVector2d::direction | ( | void | ) |
Direction.
| PhVector2d& phoenix::PhVector2d::rotate | ( | float | angle | ) |
Rotate.
Rotates the vector the desired amount.
| angle | The measure of the angle in radians. |
| 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.
| xE | The reference vector, by defualt this is <1,0> |
| float phoenix::PhVector2d::operator^ | ( | const PhVector2d & | V | ) | const |
Cross product.
Returns the cross product of the vector.
| float phoenix::PhVector2d::operator * | ( | const PhVector2d & | V | ) | const |
Dot product.
Returns the dot product.
1.5.4