#include <angle.h>
Public Types |
|
Enums
|
|
enum | Range { RANGE__UNLIMITED = 0, RANGE__UNSIGNED = 1, RANGE__SIGNED = 2 } |
form of the angle range:
RANGE__UNLIMITED = 0 no limitations
RANGE__UNSIGNED = 1 0 <= angle <= 360, 0
<= angle <= PI * 2 RANGE__SIGNED = 2
-180 <= angle <= 180, -PI <= angle <=
PI |
|
Public Member Functions |
|
Constructors and Destructors
|
|
TAngle () | |
Default constructor. |
|
TAngle (const TAngle &angle) | |
Copy constructor. |
|
TAngle (const T &new_value, bool radian=true) | |
Detailed constructor. |
|
virtual | ~TAngle () |
Destructor. |
|
virtual void | clear () |
Clear method The value is set to
0. |
|
Assignment
|
|
void | swap (TAngle &angle) |
Swap the contents of two
angles. |
|
void | set (const T &new_value, bool radian=true) |
Assign a new value to the angle.
|
|
void | set (const TAngle &angle) |
Assign an Angle object from another.
|
|
TAngle & | operator= (const TAngle &angle) |
Assignment operator. |
|
TAngle & | operator= (const T &new_value) |
Assignment operator for floats.
|
|
void | get (TAngle &angle) const |
Assign the value to another angle.
|
|
void | get (T &val, bool radian=true) const |
Assign the value to a variable of
type T . |
|
Predicates
|
|
bool | operator== (const TAngle &angle) const |
Equality operator. |
|
bool | operator!= (const TAngle &angle) const |
Inequality operator This test uses
Maths::isNotEqual instead of comparing the values directly.
|
|
bool | operator< (const TAngle &angle) const |
Is less operator. |
|
bool | operator< (const T &val) const |
Is less operator. |
|
bool | operator<= (const TAngle &angle) const |
Is less or equal operator. |
|
bool | operator>= (const TAngle &angle) const |
Is greater or equal operator.
|
|
bool | operator> (const TAngle &angle) const |
Is greater operator. |
|
bool | isEquivalent (TAngle angle) const |
Test whether two angles are
equivalent. |
|
Debugging and Diagnostics
|
|
bool | isValid () const |
Test whether instance is valid.
|
|
void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal state dump. |
|
Public Attributes |
|
Attributes
|
|
T | value |
The value. |
|
Accessors |
|
operator T () const | |
Cast operator. |
|
T | toRadian () const |
Return the value of the angle.
|
|
T | toDegree () const |
Return the value of the angle.
|
|
void | normalize (Range range) |
Normalize the angle over a given
range. |
|
void | negate () |
Negate the angle. |
|
TAngle | operator+ () const |
Positive sign. |
|
TAngle | operator- () const |
Negative sign. |
|
TAngle & | operator+= (const TAngle &angle) |
Addition operator. |
|
TAngle & | operator+= (const T &val) |
Add a value to this angle. |
|
TAngle | operator+ (const TAngle &angle) |
Addition operator. |
|
TAngle & | operator-= (const TAngle &angle) |
Substraction operator. |
|
TAngle & | operator-= (const T &val) |
Substract a value from this angle.
|
|
TAngle | operator- (const TAngle &angle) |
Subtraction an angle from this
angle. |
|
TAngle & | operator*= (const TAngle &angle) |
Multiply an angle with this angle.
|
|
TAngle & | operator*= (const T &val) |
Multiply a value with this angle.
|
|
TAngle & | operator/= (const TAngle &angle) throw (Exception::DivisionByZero) |
Division operator. |
|
TAngle & | operator/= (const T &val) throw (Exception::DivisionByZero) |
Divide this angle by a value.
|
|
TAngle | operator/ (const TAngle &val) throw (Exception::DivisionByZero) |
Divide this angle by a value.
|
|
static T | toRadian (const T °ree) |
Calculate radians from degrees.
|
|
static T | toDegree (const T &radian) |
Calculate degrees from radians.
|
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.
BALL::TAngle< T >::TAngle | ( | ) |
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 | ) |
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 |
|||
) | [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 |
void BALL::TAngle< T >::dump | ( | std::ostream & | s =
std::cout , |
|
Size | depth =
0 |
|||
) | const |
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::TAngle< T >::value.
void BALL::TAngle< T >::get | ( | T & | val, | |
bool | radian =
true |
|||
) | const |
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::TAngle< T >::value.
void BALL::TAngle< T >::get | ( | TAngle< T > & | angle | ) | const |
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 |
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().
bool BALL::TAngle< T >::isValid | ( | ) | const |
Test whether instance is valid.
Always returns true
void BALL::TAngle< T >::normalize | ( | Range | range | ) |
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, and BALL::TAngle< T >::value.
Referenced by BALL::TAngle< T >::isEquivalent().
BALL::TAngle< T >::operator T | ( | ) | const |
bool BALL::TAngle< T >::operator!= | ( | const TAngle< T > & | angle | ) | const |
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 | ) |
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 | ) |
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 | ) |
Addition operator.
angle | the angle to add |
References BALL::TAngle< T >::TAngle(), and BALL::TAngle< T >::value.
TAngle< T > & BALL::TAngle< T >::operator+= | ( | const T & | val | ) |
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 | ) |
Addition operator.
angle | the angle to add |
References BALL::TAngle< T >::value.
TAngle< T > BALL::TAngle< T >::operator- | ( | const TAngle< T > & | angle | ) |
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 T & | val | ) |
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 | ) |
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) |
TAngle< T > & BALL::TAngle< T >::operator/= | ( | const T & | val | ) | throw (Exception::DivisionByZero) |
TAngle< T > & BALL::TAngle< T >::operator/= | ( | const TAngle< T > & | angle | ) | throw (Exception::DivisionByZero) |
bool BALL::TAngle< T >::operator< | ( | const T & | val | ) | const |
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 |
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 |
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 | ) |
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.
bool BALL::TAngle< T >::operator== | ( | const TAngle< T > & | angle | ) | const |
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 |
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 |
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 | ) |
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 |
|||
) |
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::TAngle< T >::value.
T BALL::TAngle< T >::toDegree | ( | const T & | radian | ) | [static] |
Calculate degrees from radians.
radian | the value in radians |
T BALL::TAngle< T >::toDegree | ( | ) | const |
T BALL::TAngle< T >::toRadian | ( | const T & | degree | ) | [static] |
Calculate radians from degrees.
degree | the value in degrees |
T BALL::TAngle< T >::toRadian | ( | ) | const |