Public Member Functions | Related Functions | List of all members
RVO::Vector2 Class Reference

Defines a two-dimensional vector. More...

#include <Vector2.h>

Public Member Functions

 Vector2 ()
 Constructs and initializes a two-dimensional vector instance to (0.0, 0.0).
 
 Vector2 (float x, float y)
 Constructs and initializes a two-dimensional vector from the specified xy-coordinates. More...
 
float x () const
 Returns the x-coordinate of this two-dimensional vector. More...
 
float y () const
 Returns the y-coordinate of this two-dimensional vector. More...
 
Vector2 operator- () const
 Computes the negation of this two-dimensional vector. More...
 
float operator* (const Vector2 &vector) const
 Computes the dot product of this two-dimensional vector with the specified two-dimensional vector. More...
 
Vector2 operator* (float s) const
 Computes the scalar multiplication of this two-dimensional vector with the specified scalar value. More...
 
Vector2 operator/ (float s) const
 Computes the scalar division of this two-dimensional vector with the specified scalar value. More...
 
Vector2 operator+ (const Vector2 &vector) const
 Computes the vector sum of this two-dimensional vector with the specified two-dimensional vector. More...
 
Vector2 operator- (const Vector2 &vector) const
 Computes the vector difference of this two-dimensional vector with the specified two-dimensional vector. More...
 
bool operator== (const Vector2 &vector) const
 Tests this two-dimensional vector for equality with the specified two-dimensional vector. More...
 
bool operator!= (const Vector2 &vector) const
 Tests this two-dimensional vector for inequality with the specified two-dimensional vector. More...
 
Vector2operator*= (float s)
 Sets the value of this two-dimensional vector to the scalar multiplication of itself with the specified scalar value. More...
 
Vector2operator/= (float s)
 Sets the value of this two-dimensional vector to the scalar division of itself with the specified scalar value. More...
 
Vector2operator+= (const Vector2 &vector)
 Sets the value of this two-dimensional vector to the vector sum of itself with the specified two-dimensional vector. More...
 
Vector2operator-= (const Vector2 &vector)
 Sets the value of this two-dimensional vector to the vector difference of itself with the specified two-dimensional vector. More...
 

Related Functions

(Note that these are not member functions.)

Vector2 operator* (float s, const Vector2 &vector)
 Computes the scalar multiplication of the specified two-dimensional vector with the specified scalar value. More...
 
std::ostream & operator<< (std::ostream &os, const Vector2 &vector)
 Inserts the specified two-dimensional vector into the specified output stream. More...
 
float abs (const Vector2 &vector)
 Computes the length of a specified two-dimensional vector. More...
 
float absSq (const Vector2 &vector)
 Computes the squared length of a specified two-dimensional vector. More...
 
float det (const Vector2 &vector1, const Vector2 &vector2)
 Computes the determinant of a two-dimensional square matrix with rows consisting of the specified two-dimensional vectors. More...
 
Vector2 normalize (const Vector2 &vector)
 Computes the normalization of the specified two-dimensional vector. More...
 

Detailed Description

Defines a two-dimensional vector.

Constructor & Destructor Documentation

◆ Vector2()

RVO::Vector2::Vector2 ( float  x,
float  y 
)
inline

Constructs and initializes a two-dimensional vector from the specified xy-coordinates.

Parameters
xThe x-coordinate of the two-dimensional vector.
yThe y-coordinate of the two-dimensional vector.

Member Function Documentation

◆ operator!=()

bool RVO::Vector2::operator!= ( const Vector2 vector) const
inline

Tests this two-dimensional vector for inequality with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which to test for inequality.
Returns
True if the two-dimensional vectors are not equal.

◆ operator*() [1/2]

float RVO::Vector2::operator* ( const Vector2 vector) const
inline

Computes the dot product of this two-dimensional vector with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which the dot product should be computed.
Returns
The dot product of this two-dimensional vector with a specified two-dimensional vector.

◆ operator*() [2/2]

Vector2 RVO::Vector2::operator* ( float  s) const
inline

Computes the scalar multiplication of this two-dimensional vector with the specified scalar value.

Parameters
sThe scalar value with which the scalar multiplication should be computed.
Returns
The scalar multiplication of this two-dimensional vector with a specified scalar value.

◆ operator*=()

Vector2& RVO::Vector2::operator*= ( float  s)
inline

Sets the value of this two-dimensional vector to the scalar multiplication of itself with the specified scalar value.

Parameters
sThe scalar value with which the scalar multiplication should be computed.
Returns
A reference to this two-dimensional vector.

◆ operator+()

Vector2 RVO::Vector2::operator+ ( const Vector2 vector) const
inline

Computes the vector sum of this two-dimensional vector with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which the vector sum should be computed.
Returns
The vector sum of this two-dimensional vector with a specified two-dimensional vector.

◆ operator+=()

Vector2& RVO::Vector2::operator+= ( const Vector2 vector)
inline

Sets the value of this two-dimensional vector to the vector sum of itself with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which the vector sum should be computed.
Returns
A reference to this two-dimensional vector.

◆ operator-() [1/2]

Vector2 RVO::Vector2::operator- ( ) const
inline

Computes the negation of this two-dimensional vector.

Returns
The negation of this two-dimensional vector.

◆ operator-() [2/2]

Vector2 RVO::Vector2::operator- ( const Vector2 vector) const
inline

Computes the vector difference of this two-dimensional vector with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which the vector difference should be computed.
Returns
The vector difference of this two-dimensional vector with a specified two-dimensional vector.

◆ operator-=()

Vector2& RVO::Vector2::operator-= ( const Vector2 vector)
inline

Sets the value of this two-dimensional vector to the vector difference of itself with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which the vector difference should be computed.
Returns
A reference to this two-dimensional vector.

◆ operator/()

Vector2 RVO::Vector2::operator/ ( float  s) const
inline

Computes the scalar division of this two-dimensional vector with the specified scalar value.

Parameters
sThe scalar value with which the scalar division should be computed.
Returns
The scalar division of this two-dimensional vector with a specified scalar value.

◆ operator/=()

Vector2& RVO::Vector2::operator/= ( float  s)
inline

Sets the value of this two-dimensional vector to the scalar division of itself with the specified scalar value.

Parameters
sThe scalar value with which the scalar division should be computed.
Returns
A reference to this two-dimensional vector.

◆ operator==()

bool RVO::Vector2::operator== ( const Vector2 vector) const
inline

Tests this two-dimensional vector for equality with the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector with which to test for equality.
Returns
True if the two-dimensional vectors are equal.

◆ x()

float RVO::Vector2::x ( ) const
inline

Returns the x-coordinate of this two-dimensional vector.

Returns
The x-coordinate of the two-dimensional vector.

◆ y()

float RVO::Vector2::y ( ) const
inline

Returns the y-coordinate of this two-dimensional vector.

Returns
The y-coordinate of the two-dimensional vector.

Friends And Related Function Documentation

◆ abs()

float abs ( const Vector2 vector)
related

Computes the length of a specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector whose length is to be computed.
Returns
The length of the two-dimensional vector.

◆ absSq()

float absSq ( const Vector2 vector)
related

Computes the squared length of a specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector whose squared length is to be computed.
Returns
The squared length of the two-dimensional vector.

◆ det()

float det ( const Vector2 vector1,
const Vector2 vector2 
)
related

Computes the determinant of a two-dimensional square matrix with rows consisting of the specified two-dimensional vectors.

Parameters
vector1The top row of the two-dimensional square matrix.
vector2The bottom row of the two-dimensional square matrix.
Returns
The determinant of the two-dimensional square matrix.

◆ normalize()

Vector2 normalize ( const Vector2 vector)
related

Computes the normalization of the specified two-dimensional vector.

Parameters
vectorThe two-dimensional vector whose normalization is to be computed.
Returns
The normalization of the two-dimensional vector.

◆ operator*()

Vector2 operator* ( float  s,
const Vector2 vector 
)
related

Computes the scalar multiplication of the specified two-dimensional vector with the specified scalar value.

Parameters
sThe scalar value with which the scalar multiplication should be computed.
vectorThe two-dimensional vector with which the scalar multiplication should be computed.
Returns
The scalar multiplication of the two-dimensional vector with the scalar value.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const Vector2 vector 
)
related

Inserts the specified two-dimensional vector into the specified output stream.

Parameters
osThe output stream into which the two-dimensional vector should be inserted.
vectorThe two-dimensional vector which to insert into the output stream.
Returns
A reference to the output stream.

The documentation for this class was generated from the following file: