33 #ifndef RVO_VECTOR2_H_ 34 #define RVO_VECTOR2_H_ 64 inline Vector2(
float x,
float y) : x_(x), y_(y) { }
70 inline float x()
const {
return x_; }
76 inline float y()
const {
return y_; }
97 return x_ * vector
.x() + y_ * vector
.y();
123 const float invS = 1.0f / s;
163 return x_ == vector
.x() && y_ == vector
.y();
175 return x_ != vector
.x() || y_ != vector
.y();
202 const float invS = 1.0f / s;
271 inline std::ostream &operator<<(std::ostream &os,
const Vector2 &vector)
273 os <<
"(" << vector
.x() <<
"," << vector
.y() <<
")";
287 return std::sqrt(vector
* vector);
300 return vector
* vector;
328 return vector
/ abs(vector
);
Defines a two-dimensional vector.
Definition: Vector2.h:48
bool operator==(const Vector2 &vector) const
Tests this two-dimensional vector for equality with the specified two-dimensional vector...
Definition: Vector2.h:161
Vector2 operator-(const Vector2 &vector) const
Computes the vector difference of this two-dimensional vector with the specified two-dimensional vect...
Definition: Vector2.h:149
Vector2 operator*(float s, const Vector2 &vector)
Computes the scalar multiplication of the specified two-dimensional vector with the specified scalar ...
Definition: Vector2.h:256
Vector2 & operator/=(float s)
Sets the value of this two-dimensional vector to the scalar division of itself with the specified sca...
Definition: Vector2.h:200
Vector2 operator-() const
Computes the negation of this two-dimensional vector.
Definition: Vector2.h:82
float det(const Vector2 &vector1, const Vector2 &vector2)
Computes the determinant of a two-dimensional square matrix with rows consisting of the specified two...
Definition: Vector2.h:313
float operator*(const Vector2 &vector) const
Computes the dot product of this two-dimensional vector with the specified two-dimensional vector...
Definition: Vector2.h:95
Vector2 normalize(const Vector2 &vector)
Computes the normalization of the specified two-dimensional vector.
Definition: Vector2.h:326
Vector2 operator+(const Vector2 &vector) const
Computes the vector sum of this two-dimensional vector with the specified two-dimensional vector...
Definition: Vector2.h:136
Vector2 operator/(float s) const
Computes the scalar division of this two-dimensional vector with the specified scalar value...
Definition: Vector2.h:121
bool operator!=(const Vector2 &vector) const
Tests this two-dimensional vector for inequality with the specified two-dimensional vector...
Definition: Vector2.h:173
float abs(const Vector2 &vector)
Computes the length of a specified two-dimensional vector.
Definition: Vector2.h:285
Vector2(float x, float y)
Constructs and initializes a two-dimensional vector from the specified xy-coordinates.
Definition: Vector2.h:64
Vector2()
Constructs and initializes a two-dimensional vector instance to (0.0, 0.0).
Definition: Vector2.h:54
Vector2 operator*(float s) const
Computes the scalar multiplication of this two-dimensional vector with the specified scalar value...
Definition: Vector2.h:108
Vector2 & operator+=(const Vector2 &vector)
Sets the value of this two-dimensional vector to the vector sum of itself with the specified two-dime...
Definition: Vector2.h:216
Vector2 & operator*=(float s)
Sets the value of this two-dimensional vector to the scalar multiplication of itself with the specifi...
Definition: Vector2.h:185
Vector2 & operator-=(const Vector2 &vector)
Sets the value of this two-dimensional vector to the vector difference of itself with the specified t...
Definition: Vector2.h:232
float absSq(const Vector2 &vector)
Computes the squared length of a specified two-dimensional vector.
Definition: Vector2.h:298
float y() const
Returns the y-coordinate of this two-dimensional vector.
Definition: Vector2.h:76
float x() const
Returns the x-coordinate of this two-dimensional vector.
Definition: Vector2.h:70