ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
A 2D vector class. More...
#include <vector2.h>
Public Member Functions | |
CVector2 () | |
Class constructor. | |
CVector2 (Real f_x, Real f_y) | |
Class constructor. | |
CVector2 (Real f_length, const CRadians &f_angle) | |
Class constructor. | |
Real | GetX () const |
Returns the x coordinate of this vector. | |
void | SetX (Real f_x) |
Sets the x coordinate of this vector. | |
Real | GetY () const |
Returns the y coordinate of this vector. | |
void | SetY (Real f_y) |
Sets the y coordinate of this vector. | |
void | Set (Real f_x, Real f_y) |
Sets the vector contents from Cartesian coordinates. | |
void | FromPolarCoordinates (Real f_length, const CRadians &f_angle) |
Sets the vector contents from polar coordinates. | |
Real | SquareLength () const |
Returns the square length of this vector. | |
Real | Length () const |
Returns the length of this vector. | |
CVector2 & | Normalize () |
Normalizes this vector. | |
CRadians | Angle () const |
Returns the angle of this vector. | |
CVector2 & | Rotate (const CRadians &c_angle) |
Rotates this vector by the wanted angle. | |
Real | DotProduct (const CVector2 &c_vector2) const |
Returns the dot product between this vector and the passed one. | |
CVector2 & | Scale (Real f_scale_x, Real f_scale_y) |
Scales the vector by the wanted values. | |
CVector2 & | Perpendicularize () |
Transforms this vector into its ortogonal. | |
CVector2 & | Absolute () |
Applies Abs() to the coordinates of this vector. | |
bool | operator== (const CVector2 &c_vector2) |
Returns true if this vector and the passed one are equal. | |
bool | operator!= (const CVector2 &c_vector2) |
Returns true if this vector and the passed one are not equal. | |
CVector2 & | operator+= (const CVector2 &c_vector2) |
Sums the passed vector to this vector. | |
CVector2 & | operator-= (const CVector2 &c_vector2) |
Subtracts the passed vector from this vector. | |
CVector2 & | operator*= (Real f_value) |
Multiplies this vector by the given value. | |
CVector2 & | operator/= (Real f_value) |
Divides this vector by the given value. | |
CVector2 | operator+ (const CVector2 &c_vector2) const |
Returns a new vector containing the sum between this vector and the passed one. | |
CVector2 | operator- (const CVector2 &c_vector2) const |
Returns a new vector containing the subtraction between this vector and the passed one. | |
CVector2 | operator* (Real f_value) const |
Returns a new vector containing the multiplication between this vector and the passed value. | |
CVector2 | operator/ (Real f_value) const |
Returns a new vector containing the division between this vector and the passed value. | |
CVector2 | operator- () const |
Static Public Attributes | |
static const CVector2 | X |
The x axis. | |
static const CVector2 | Y |
The y axis. | |
Friends | |
class | CRotationMatrix2 |
class | CTransformationMatrix2 |
CVector2 | operator* (Real f_value, const CVector2 &c_vector2) |
Returns a new vector containing the multiplication between the passed value and the passed vector. | |
std::ostream & | operator<< (std::ostream &c_os, const CVector2 &c_vector2) |
Serializes the contents of the passed vector onto a stream. | |
std::istream & | operator>> (std::istream &c_is, CVector2 &c_vector2) |
Deserializes the contents of a stream and stores them into the passed vector. |
argos::CVector2::CVector2 | ( | ) | [inline] |
argos::CVector2::CVector2 | ( | Real | f_x, |
Real | f_y | ||
) | [inline] |
argos::CVector2::CVector2 | ( | Real | f_length, |
const CRadians & | f_angle | ||
) | [inline] |
Class constructor.
It initializes the vector coordinates from polar coordinates.
f_length | the vector length. |
f_angle | the vector angle. |
CVector2& argos::CVector2::Absolute | ( | ) | [inline] |
CRadians argos::CVector2::Angle | ( | ) | const [inline] |
Real argos::CVector2::DotProduct | ( | const CVector2 & | c_vector2 | ) | const [inline] |
void argos::CVector2::FromPolarCoordinates | ( | Real | f_length, |
const CRadians & | f_angle | ||
) | [inline] |
Real argos::CVector2::GetX | ( | ) | const [inline] |
Real argos::CVector2::GetY | ( | ) | const [inline] |
Real argos::CVector2::Length | ( | ) | const [inline] |
CVector2& argos::CVector2::Normalize | ( | ) | [inline] |
bool argos::CVector2::operator!= | ( | const CVector2 & | c_vector2 | ) | [inline] |
bool argos::CVector2::operator== | ( | const CVector2 & | c_vector2 | ) | [inline] |
CVector2& argos::CVector2::Perpendicularize | ( | ) | [inline] |
CVector2& argos::CVector2::Rotate | ( | const CRadians & | c_angle | ) | [inline] |
CVector2& argos::CVector2::Scale | ( | Real | f_scale_x, |
Real | f_scale_y | ||
) | [inline] |
Scales the vector by the wanted values.
This method scales the vector by the wanted values. In practice, this means that it multiplies the x coordinate by f_scale_x and the y coordinate by f_scale_y.
f_scale_x | the scale factor for the x coordinate. |
f_scale_y | the scale factor for the y coordinate. |
void argos::CVector2::Set | ( | Real | f_x, |
Real | f_y | ||
) | [inline] |
void argos::CVector2::SetX | ( | Real | f_x | ) | [inline] |
void argos::CVector2::SetY | ( | Real | f_y | ) | [inline] |
Real argos::CVector2::SquareLength | ( | ) | const [inline] |
friend class CRotationMatrix2 [friend] |
friend class CTransformationMatrix2 [friend] |
std::ostream& operator<< | ( | std::ostream & | c_os, |
const CVector2 & | c_vector2 | ||
) | [friend] |
std::istream& operator>> | ( | std::istream & | c_is, |
CVector2 & | c_vector2 | ||
) | [friend] |
const CVector2 argos::CVector2::X [static] |
const CVector2 argos::CVector2::Y [static] |