#include <BALL/MATHS/angle.h>
Public Types | |
Enums | |
enum | Range { RANGE__UNLIMITED = 0, RANGE__UNSIGNED = 1, RANGE__SIGNED = 2 } |
Public Member Functions | |
Constructors and Destructors | |
TAngle () | |
TAngle (const TAngle &angle) | |
TAngle (const T &new_value, bool radian=true) | |
virtual | ~TAngle () |
virtual void | clear () |
Assignment | |
void | swap (TAngle &angle) |
void | set (const T &new_value, bool radian=true) |
void | set (const TAngle &angle) |
TAngle & | operator= (const TAngle &angle) |
TAngle & | operator= (const T &new_value) |
void | get (TAngle &angle) const |
void | get (T &val, bool radian=true) const |
Predicates | |
bool | operator== (const TAngle &angle) const |
bool | operator!= (const TAngle &angle) const |
bool | operator< (const TAngle &angle) const |
bool | operator< (const T &val) const |
bool | operator<= (const TAngle &angle) const |
bool | operator>= (const TAngle &angle) const |
bool | operator> (const TAngle &angle) const |
bool | isEquivalent (TAngle angle) const |
Debugging and Diagnostics | |
bool | isValid () const |
void | dump (std::ostream &s=std::cout, Size depth=0) const |
Public Attributes | |
Attributes | |
T | value |
Accessors | |
operator T () const | |
T | toRadian () const |
T | toDegree () const |
void | normalize (Range range) |
void | negate () |
TAngle | operator+ () const |
TAngle | operator- () const |
TAngle & | operator+= (const TAngle &angle) |
TAngle & | operator+= (const T &val) |
TAngle | operator+ (const TAngle &angle) |
TAngle & | operator-= (const TAngle &angle) |
TAngle & | operator-= (const T &val) |
TAngle | operator- (const TAngle &angle) |
TAngle & | operator*= (const TAngle &angle) |
TAngle & | operator*= (const T &val) |
TAngle & | operator/= (const TAngle &angle) throw (Exception::DivisionByZero) |
TAngle & | operator/= (const T &val) throw (Exception::DivisionByZero) |
TAngle | operator/ (const TAngle &val) throw (Exception::DivisionByZero) |
static T | toRadian (const T °ree) |
static T | toDegree (const T &radian) |
Generic Angle Class. Use this class to describe angles. The TAngle class permits the conversion from degree to radians and is the return type of all functions used to calculate angles.
enum BALL::TAngle::Range |
BALL::TAngle< T >::TAngle | ( | ) | [inline] |
Default constructor. Creates a new angle object. Its value is set to 0.
Referenced by BALL::TAngle< T >::operator+(), and BALL::TAngle< T >::operator-().
BALL::TAngle< T >::TAngle | ( | const TAngle< T > & | angle | ) | [inline] |
Copy constructor. Create a copy of a TAngle object. Copies are always shallow.
angle | the object to be copied |
BALL::TAngle< T >::TAngle | ( | const T & | new_value, | |
bool | radian = true | |||
) | [inline, explicit] |
Detailed constructor. Create a new angle object and set its value to new_value
. radian
determines whether new_value
is in radians or in degrees.
new_value | the value of the angle object | |
radian | true if new_value is in radians, false otherwise |
virtual BALL::TAngle< T >::~TAngle | ( | ) | [inline, virtual] |
Destructor.
virtual void BALL::TAngle< T >::clear | ( | ) | [inline, virtual] |
Clear method The value is set to 0.
void BALL::TAngle< T >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline] |
Internal state dump. Dump the current internal state of {*this} to the output ostream s with dumping depth depth .
s | - output stream where to output the internal state of {*this} | |
depth | - the dumping depth |
References BALL_DUMP_DEPTH, BALL_DUMP_HEADER, BALL_DUMP_STREAM_PREFIX, BALL_DUMP_STREAM_SUFFIX, and BALL::TAngle< T >::value.
void BALL::TAngle< T >::get | ( | T & | val, | |
bool | radian = true | |||
) | const [inline] |
Assign the value to a variable of type T
.
val | the variable to assign the value to | |
radian | if set to true assigns the value in radians (default). |
References BALL_ANGLE_RADIAN_TO_DEGREE, and BALL::TAngle< T >::value.
void BALL::TAngle< T >::get | ( | TAngle< T > & | angle | ) | const [inline] |
Assign the value to another angle.
angle | the angle to assign the value to |
References BALL::TAngle< T >::value.
bool BALL::TAngle< T >::isEquivalent | ( | TAngle< T > | angle | ) | const [inline] |
Test whether two angles are equivalent. Both angles are normalized and afterwards compared with Maths::isEqual instead of comparing the values directly.
angle | the angle to compare with |
value
References BALL::TAngle< T >::normalize(), and BALL::TAngle< T >::RANGE__UNSIGNED.
bool BALL::TAngle< T >::isValid | ( | ) | const [inline] |
Test whether instance is valid. Always returns true
void BALL::TAngle< T >::negate | ( | ) | [inline] |
Negate the angle
References BALL::TAngle< T >::value.
void BALL::TAngle< T >::normalize | ( | Range | range | ) | [inline] |
Normalize the angle over a given range. RANGE__UNLIMITED = 0
no limitations. RANGE__UNSIGNED = 1
. RANGE__SIGNED = 2
.
range | the range of the angle |
References BALL::Maths::isGreater(), BALL::Maths::isLess(), BALL::Constants::PI, BALL::TAngle< T >::RANGE__SIGNED, BALL::TAngle< T >::RANGE__UNLIMITED, and BALL::TAngle< T >::value.
Referenced by BALL::TAngle< T >::isEquivalent().
BALL::TAngle< T >::operator T | ( | ) | const [inline] |
bool BALL::TAngle< T >::operator!= | ( | const TAngle< T > & | angle | ) | const [inline] |
Inequality operator This test uses Maths::isNotEqual instead of comparing the values directly.
angle | the angle to compare with |
References BALL::Maths::isNotEqual(), and BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator*= | ( | const T & | val | ) | [inline] |
Multiply a value with this angle.
val | the value to multiply by |
References BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator*= | ( | const TAngle< T > & | angle | ) | [inline] |
Multiply an angle with this angle.
angle | the angle to multiply by |
References BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator+ | ( | const TAngle< T > & | angle | ) | [inline] |
Addition operator.
angle | the angle to add |
References BALL::TAngle< T >::TAngle(), and BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator+ | ( | ) | const [inline] |
Positive sign.
TAngle< T > & BALL::TAngle< T >::operator+= | ( | const T & | val | ) | [inline] |
Add a value to this angle.
val | the value to add |
References BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator+= | ( | const TAngle< T > & | angle | ) | [inline] |
Addition operator.
angle | the angle to add |
References BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator- | ( | const TAngle< T > & | angle | ) | [inline] |
Subtraction an angle from this angle.
angle | the angle to substract |
References BALL::TAngle< T >::TAngle(), and BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator- | ( | ) | const [inline] |
Negative sign.
References BALL::TAngle< T >::TAngle(), and BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator-= | ( | const T & | val | ) | [inline] |
Substract a value from this angle.
val | the value to substract |
References BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator-= | ( | const TAngle< T > & | angle | ) | [inline] |
Substraction operator.
angle | the angle to substract |
References BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator/ | ( | const TAngle< T > & | val | ) | throw (Exception::DivisionByZero) [inline] |
TAngle< T > & BALL::TAngle< T >::operator/= | ( | const T & | val | ) | throw (Exception::DivisionByZero) [inline] |
TAngle< T > & BALL::TAngle< T >::operator/= | ( | const TAngle< T > & | angle | ) | throw (Exception::DivisionByZero) [inline] |
bool BALL::TAngle< T >::operator< | ( | const T & | val | ) | const [inline] |
Is less operator. This test uses Maths::isLess instead of comparing the values directly.
val | the value to compare with |
value
References BALL::Maths::isLess(), and BALL::TAngle< T >::value.
bool BALL::TAngle< T >::operator< | ( | const TAngle< T > & | angle | ) | const [inline] |
Is less operator. This test uses Maths::isLess instead of comparing the values directly.
angle | the angle to compare with |
value
References BALL::Maths::isLess(), and BALL::TAngle< T >::value.
bool BALL::TAngle< T >::operator<= | ( | const TAngle< T > & | angle | ) | const [inline] |
Is less or equal operator. This test uses Maths::isLessOrEqual instead of comparing the values directly.
angle | the angle to compare with |
value
References BALL::Maths::isLessOrEqual(), and BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator= | ( | const T & | new_value | ) | [inline] |
Assignment operator for floats. Assign a float value to the angle. The assigned value has to be in radians!
new_value | the new value |
References BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator= | ( | const TAngle< T > & | angle | ) | [inline] |
Assignment operator
References BALL::TAngle< T >::value.
bool BALL::TAngle< T >::operator== | ( | const TAngle< T > & | angle | ) | const [inline] |
Equality operator. This test uses Maths::isEqual instead of comparing the values directly.
angle | the angle to compare with |
References BALL::Maths::isEqual(), and BALL::TAngle< T >::value.
bool BALL::TAngle< T >::operator> | ( | const TAngle< T > & | angle | ) | const [inline] |
Is greater operator. This test uses Maths::isGreater instead of comparing the values directly.
angle | the angle to compare with |
value
References BALL::Maths::isGreater(), and BALL::TAngle< T >::value.
bool BALL::TAngle< T >::operator>= | ( | const TAngle< T > & | angle | ) | const [inline] |
Is greater or equal operator. This test uses Maths::isGreaterOrEqual instead of comparing the values directly.
angle | the angle to compare with |
value
References BALL::Maths::isGreaterOrEqual(), and BALL::TAngle< T >::value.
void BALL::TAngle< T >::set | ( | const TAngle< T > & | angle | ) | [inline] |
Assign an Angle object from another.
angle | the angle object to be assigned from |
References BALL::TAngle< T >::value.
void BALL::TAngle< T >::set | ( | const T & | new_value, | |
bool | radian = true | |||
) | [inline] |
Assign a new value to the angle. radian
determines whether new_value
is in radians or in degrees.
new_value | the value of the angle object | |
radian | true if new_value is in radians, false otherwise |
References BALL_ANGLE_DEGREE_TO_RADIAN, and BALL::TAngle< T >::value.
void BALL::TAngle< T >::swap | ( | TAngle< T > & | angle | ) | [inline] |
Swap the contents of two angles.
References BALL::TAngle< T >::value.
T BALL::TAngle< T >::toDegree | ( | const T & | radian | ) | [inline, static] |
Calculate degrees from radians
radian | the value in radians |
References BALL_ANGLE_RADIAN_TO_DEGREE.
T BALL::TAngle< T >::toDegree | ( | ) | const [inline] |
Return the value of the angle
References BALL_ANGLE_RADIAN_TO_DEGREE, and BALL::TAngle< T >::value.
T BALL::TAngle< T >::toRadian | ( | const T & | degree | ) | [inline, static] |
Calculate radians from degrees
degree | the value in degrees |
References BALL_ANGLE_DEGREE_TO_RADIAN.
T BALL::TAngle< T >::toRadian | ( | ) | const [inline] |
T BALL::TAngle< T >::value |
The value
Referenced by BALL::TAngle< float >::clear(), BALL::TAngle< T >::dump(), BALL::TAngle< T >::get(), BALL::TVector3< float >::getAngle_(), BALL::TAngle< T >::negate(), BALL::TAngle< T >::normalize(), BALL::TAngle< T >::operator T(), BALL::TAngle< T >::operator!=(), BALL::operator*(), BALL::TAngle< T >::operator*=(), BALL::operator+(), BALL::TAngle< T >::operator+(), BALL::TAngle< T >::operator+=(), BALL::operator-(), BALL::TAngle< T >::operator-(), BALL::TAngle< T >::operator-=(), BALL::TAngle< T >::operator<(), BALL::TAngle< T >::operator<=(), BALL::TAngle< T >::operator=(), BALL::TAngle< T >::operator==(), BALL::TAngle< T >::operator>(), BALL::TAngle< T >::operator>=(), BALL::operator>>(), BALL::TAngle< T >::set(), BALL::TAngle< T >::swap(), BALL::TAngle< T >::toDegree(), and BALL::TAngle< T >::toRadian().