A two-dimensional vector class. More...
#include <Vector2D.h>
Public Member Functions | |
Vector2D () | |
Vector2D (const Vector2D &v) | |
Copy constructor. More... | |
Vector2D (float _x, float _y) | |
Constructor. More... | |
Vector2D | operator+ (const Vector2D &v) const |
Vector addition. More... | |
Vector2D | operator- (const Vector2D &v) const |
Vector subtraction. More... | |
float | operator* (const Vector2D &v) const |
Dot product. More... | |
Vector2D | operator* (const float a) const |
Scalar multiplication. More... | |
Vector2D | operator/ (const float a) const |
Scalar division. More... | |
float | operator^ (const Vector2D &v) const |
Cross product. More... | |
void | operator+= (const Vector2D &v) |
Adds a 2d vector to the current vector. More... | |
void | operator-= (const Vector2D &v) |
Subtracts a 2d vector from the current vector. More... | |
void | operator*= (const float &a) |
Multiplies the vector by a scalar. More... | |
void | operator/= (const float &a) |
Divides the vector by a scalar. More... | |
bool | operator== (const Vector2D &v) const |
Vector equality. More... | |
bool | operator!= (const Vector2D &v) const |
Vector inequality. More... | |
void | normalize () |
float | length () const |
float | lengthSqr () const |
Vector2D | perpendicular () const |
Public Attributes | |
float | x |
float | y |
A two-dimensional vector class.
|
inline |
Constructs a null vector.
|
inline |
Copy constructor.
v | The vector to be copied. |
|
inline |
Constructor.
_x | The x-component of the new vector. |
_y | The y-component of the new vector. |
|
inline |
|
inline |
|
inline |
|
inline |
Vector inequality.
v | The right hand side vector |
|
inline |
Dot product.
v | The right hand side vector |
|
inline |
Scalar multiplication.
a | The scalar. |
|
inline |
Multiplies the vector by a scalar.
a | The scalar. |
Vector addition.
v | The vector to be added. |
|
inline |
Adds a 2d vector to the current vector.
v | The vector to be added. |
Vector subtraction.
v | The vector to be added. |
|
inline |
Subtracts a 2d vector from the current vector.
v | The vector to be substracted. |
|
inline |
Scalar division.
a | The scalar. |
|
inline |
Divides the vector by a scalar.
a | The scalar. |
|
inline |
Vector equality.
v | The right hand side vector |
|
inline |
Cross product.
v | The right hand side vector |
|
inline |
float TTC::Vector2D::x |
The x-component of the vector.
float TTC::Vector2D::y |
The y-component of the vector.