Embodiment of an angular value. More...
#include <Util/Angle.H>
Public Member Functions | |
Constructors, destructor, assigments, and conversions | |
Angle (const double val=0.0) | |
Constructor. Initial value should be in degrees. | |
Angle (const Angle &ang) | |
Copy constructor. | |
~Angle () | |
Destructor. | |
Angle & | operator= (const Angle &ang) |
Assignment. | |
Angle & | operator= (const double ang) |
Assignment. | |
void | setVal (const double val) |
Set a new value in degrees. | |
double | getVal () const |
Get current value in degrees in ]-180.0 .. 180.0]. | |
void | setRadians (const double val) |
Conversion from radians. | |
double | getRadians () const |
Get value in radians (in [-pi .. pi]). | |
Arithmetic operators | |
Angle & | operator+= (const Angle &other) |
Addition. Result is taken modulo 360 and remains in ]-180.0 .. 180.0]. | |
Angle & | operator-= (const Angle &other) |
Subtraction. Result is taken modulo 360 and remains in ]-180.0 .. 180.0]. | |
Angle & | operator*= (const double fac) |
Multiplication by a constant. Result remains in ]-180.0 .. 180.0]. | |
Angle & | operator/= (const double fac) |
Division by a constant. Result remains in ]-180.0 .. 180.0]. | |
Angle | operator+ (const Angle &other) const |
Addition of two angles. Result remains in ]-180.0 .. 180.0]. | |
Angle | operator- (const Angle &other) const |
Subtraction of two angles. Result remains in ]-180.0 .. 180.0]. | |
void | vectorAdd (const Angle &other, const double otherlen=1.0) |
Combine with another angle, in vector style. | |
bool | operator< (const Angle &other) const |
Comparison. USE WITH CAUTION! | |
bool | operator> (const Angle &other) const |
Comparison. USE WITH CAUTION! | |
bool | operator!= (const Angle &other) const |
Comparison. USE WITH CAUTION! | |
bool | operator< (const double other) const |
Comparison. USE WITH CAUTION! | |
bool | operator> (const double other) const |
Comparison. USE WITH CAUTION! | |
bool | operator!= (const double other) const |
Comparison. USE WITH CAUTION! |
Embodiment of an angular value.
This class provides functions to manipulate and do maths on angles. The internal representation is a double value in degrees in the range ]-180.0 .. 180.0]. This is an all-inlined class, so there is no Angle.C file.
Definition at line 49 of file Angle.H.
Angle::Angle | ( | const double | val = 0.0 |
) | [inline] |
Angle::Angle | ( | const Angle & | ang | ) | [inline] |
double Angle::getRadians | ( | ) | const [inline] |
Get value in radians (in [-pi .. pi]).
Definition at line 201 of file Angle.H.
Referenced by BeoSubOneBal::advanceRel(), and SeaBee::advanceRel().
double Angle::getVal | ( | ) | const [inline] |
Get current value in degrees in ]-180.0 .. 180.0].
Definition at line 193 of file Angle.H.
Referenced by main(), IMUListener::newData(), TestHMR3300Listener::newData(), TestBeoSubIMUListener::newData(), BeoSub::pitchAbs(), BeoSub::targetReached(), and BeoSub::turnAbs().
bool Angle::operator!= | ( | const double | other | ) | const [inline] |
bool Angle::operator!= | ( | const Angle & | other | ) | const [inline] |
Angle & Angle::operator*= | ( | const double | fac | ) | [inline] |
Angle & Angle::operator/= | ( | const double | fac | ) | [inline] |
bool Angle::operator< | ( | const double | other | ) | const [inline] |
bool Angle::operator< | ( | const Angle & | other | ) | const [inline] |
Angle & Angle::operator= | ( | const double | ang | ) | [inline] |
bool Angle::operator> | ( | const double | other | ) | const [inline] |
bool Angle::operator> | ( | const Angle & | other | ) | const [inline] |
void Angle::setRadians | ( | const double | val | ) | [inline] |
void Angle::setVal | ( | const double | val | ) | [inline] |
Set a new value in degrees.
Definition at line 189 of file Angle.H.
Referenced by BeoSubDB::initializeDatabase().
void Angle::vectorAdd | ( | const Angle & | other, | |
const double | otherlen = 1.0 | |||
) | [inline] |
Combine with another angle, in vector style.
This computes the sum of a unit vector with our angle and a vector with other's angle and optionally a given length. The result is the angle of the combined vector. Special cases (e.g., other is the exact opposite of us) are handled like atan2() would.