A class describing a simple 2D vector. More...
#include <vector2d.h>
Public Member Functions | |
Vector2D (const float x=0, const float y=0) | |
default constructor | |
Vector2D | operator* (const float k) const |
a method to multiply a vector by a scalar | |
Vector2D | operator/ (const float k) const |
a method to divide a vector by a scalar | |
Vector2D | operator+ (const Vector2D &b) const |
a method to add a vector to a vector | |
Vector2D | operator- (const Vector2D &b) const |
a method to subtract a vector from a vector | |
Vector2D | operator- () const |
a method to negate a vector | |
float | length () const |
a method to calculate the length of the vector | |
float | sqlength () const |
a method to calculate the length of the vector | |
float | dot (Vector2D b) |
a method to calculate the dot product of two vectors | |
Vector2D | ort (Vector2D b) |
a method that returns the orthogonal complement of two vectors | |
float | getX () |
float | getY () |
Private Attributes | |
float | x |
the x part of the vector | |
float | y |
the y part of the vector | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Vector2D &b) |
a convenience method to print a vector | |
A class describing a simple 2D vector.