#include <R2.h>
Public Member Functions | |
Position () | |
Default constructor. | |
Position (const Decimal &x_in, const Decimal &y_in) | |
x y constructor. | |
Position (const Angle &theta) | |
Angle constructor (gives sin() and cos() of theta). | |
Position (const Decimal &d, const Angle &theta) | |
Distance angle constructor (gives d*sin(theta) and d*cos(theta)). | |
Position (const Position &p) | |
Copy constructor. | |
void | setX (const Decimal &x) |
Sets x coordinate. | |
void | setY (const Decimal &y) |
Sets y coordinate. | |
Position & | operator= (const Position &rhs) |
Assigment operator =. | |
Position & | operator+= (const Position &a) |
Compound assignment operator +=. | |
Position & | operator-= (const Position &a) |
Compound assignment operator -=. | |
Position & | operator*= (const Decimal &scalar) |
Compound assignment operator product by a scalar *=. | |
Position & | operator/= (const Decimal &scalar) |
Compound assignment operator division by a scalar /=. | |
Position & | operator+= (const Decimal &scalar) |
Compound assignment operator sum by a scalar. | |
Position & | operator+= (const Angle &angle) |
Compound assignment operator sum by a Angle. | |
Position & | operator-= (const Decimal &scalar) |
Compound assignment operator sub by a scalar. | |
Position & | operator-= (const Angle &angle) |
Compound assignment operator sub by a Angle. | |
Position | operator+ (const Decimal &other) const |
Binary arithmetic operator +. | |
Position | operator- (const Decimal &other) const |
Binary arithmetic operator -. | |
Position | operator+ (const Angle &other) const |
Binary arithmetic operator +. | |
Position | operator- (const Angle &other) const |
Binary arithmetic operator -. | |
Position | operator+ (const Position &other) const |
Binary arithmetic operator +. | |
Position | operator- (const Position &other) const |
Binary arithmetic operator -. | |
Position | operator* (const Decimal &scalar) const |
binary arithmetic operator product by a scalar | |
Position | operator/ (const Decimal &scalar) const |
binary arithmetic operator division by a scalar | |
bool | operator== (const Position &other) const |
compound operator == */ | |
bool | operator!= (const Position &other) const |
compound operator != */ | |
Position | minimum (const Position &p) const |
minimum with another position | |
Position | maximum (const Position &p) const |
maximum with another position | |
Decimal | x () const |
x coordinate | |
Decimal | y () const |
y coordinate | |
Decimal | norm () const |
Norm of the vector. | |
Decimal | squareNorm () const |
Gets the square of the norm of the vector. | |
Decimal | dist (const Position &p) const |
Distance between two vectors. | |
Angle | bearing () const |
Anomaly in polar coordinates. | |
Decimal | bearingInv () const |
Anomaly in polar coordinates. | |
Decimal | scalar (const Position &p) const |
Scalar product. | |
vector< Decimal > | vectorize () const |
Create a 2-compnents vector from the Position. | |
string | print (int precision=4) const |
print | |
bool | fromString (const string &s) |
string | toString () const |
Protected Attributes | |
Decimal | _x |
Decimal | _y |
Position::Position | ( | ) |
Default constructor.
Creates a Position with x=0.0, y=0.0.
x y constructor.
&x_in | Given value for the x coordinate. | |
&y_in | Given value for the y coordinate. Creates a Position with the specified values. |
Position::Position | ( | const Angle & | theta | ) |
Distance angle constructor (gives d*sin(theta) and d*cos(theta)).
&d | Given value for the distance. | |
&theta | Given value for the angle. Creates a Position vector with the specified distance and angle, as [d*sin(theta), d*cos(theta)]. |
void Position::setX | ( | const Decimal & | x | ) |
Sets x coordinate.
&x | Value to be set. |
void Position::setY | ( | const Decimal & | y | ) |
Sets y coordinate.
&y | Value to be set. |
Compound assignment operator product by a scalar *=.
Compound assignment operator division by a scalar /=.
Compound assignment operator sum by a scalar.
Compound assignment operator sub by a scalar.
binary arithmetic operator product by a scalar
binary arithmetic operator division by a scalar
bool Position::operator== | ( | const Position & | other | ) | const |
compound operator == */
bool Position::operator!= | ( | const Position & | other | ) | const |
compound operator != */
Decimal Position::x | ( | void | ) | const |
x coordinate
Decimal Position::y | ( | void | ) | const |
y coordinate
Decimal Position::norm | ( | ) | const |
Norm of the vector.
Decimal Position::squareNorm | ( | ) | const |
Gets the square of the norm of the vector.
Angle Position::bearing | ( | ) | const |
Anomaly in polar coordinates.
Decimal Position::bearingInv | ( | ) | const |
Anomaly in polar coordinates.
Scalar product.
[in] | p | The other position. |
vector< Decimal > Position::vectorize | ( | ) | const |
string Position::print | ( | int | precision = 4 |
) | const |
bool Position::fromString | ( | const string & | s | ) |
string Position::toString | ( | ) | const |
Decimal Position::_x [protected] |
Decimal Position::_y [protected] |