5 namespace HybridAStar {
13 inline Vector2D(
const float x = 0,
const float y = 0) { this->
x =
x; this->
y =
y; }
25 friend std::ostream&
operator<<(std::ostream& os,
const Vector2D& b) {os <<
"(" << b.
x <<
"|" << b.
y <<
")";
return os; }
27 float length()
const {
return std::sqrt(std::pow(
x, 2) + std::pow(
y, 2)); }
40 inline float getX() {
return x; }
41 inline float getY() {
return y; }
Vector2D operator-() const
a method to negate a vector
Definition: vector2d.h:23
Vector2D(const float x=0, const float y=0)
default constructor
Definition: vector2d.h:13
Vector2D operator*(const float k) const
a method to multiply a vector by a scalar
Definition: vector2d.h:15
float y
the y part of the vector
Definition: vector2d.h:48
float length() const
a method to calculate the length of the vector
Definition: vector2d.h:27
friend std::ostream & operator<<(std::ostream &os, const Vector2D &b)
a convenience method to print a vector
Definition: vector2d.h:25
float dot(Vector2D b)
a method to calculate the dot product of two vectors
Definition: vector2d.h:31
A class describing a simple 2D vector.
Definition: vector2d.h:10
Vector2D operator+(const Vector2D &b) const
a method to add a vector to a vector
Definition: vector2d.h:19
Vector2D ort(Vector2D b)
a method that returns the orthogonal complement of two vectors
Definition: vector2d.h:33
float x
the x part of the vector
Definition: vector2d.h:46
Vector2D operator/(const float k) const
a method to divide a vector by a scalar
Definition: vector2d.h:17
float sqlength() const
a method to calculate the length of the vector
Definition: vector2d.h:29