BALL::TAngle< T > Class Template Reference
[Representation of angles.]

#include <BALL/MATHS/angle.h>

List of all members.

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)
TAngleoperator= (const TAngle &angle)
TAngleoperator= (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

value

Accessors



 operator T () const
toRadian () const
toDegree () const
void normalize (Range range)
void negate ()
TAngle operator+ () const
TAngle operator- () const
TAngleoperator+= (const TAngle &angle)
TAngleoperator+= (const T &val)
TAngle operator+ (const TAngle &angle)
TAngleoperator-= (const TAngle &angle)
TAngleoperator-= (const T &val)
TAngle operator- (const TAngle &angle)
TAngleoperator*= (const TAngle &angle)
TAngleoperator*= (const T &val)
TAngleoperator/= (const TAngle &angle)
TAngleoperator/= (const T &val)
TAngle operator/ (const TAngle &val)
static T toRadian (const T &degree)
static T toDegree (const T &radian)

Detailed Description

template<typename T>
class BALL::TAngle< T >

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.

Definition at line 52 of file angle.h.


Member Enumeration Documentation

template<typename T>
enum BALL::TAngle::Range

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

Enumerator:
RANGE__UNLIMITED 
RANGE__UNSIGNED 
RANGE__SIGNED 

Definition at line 67 of file angle.h.


Constructor & Destructor Documentation

template<typename T >
BALL::TAngle< T >::TAngle (  )  [inline]

Default constructor. Creates a new angle object. Its value is set to 0.

Definition at line 384 of file angle.h.

template<typename T >
BALL::TAngle< T >::TAngle ( const TAngle< T > &  angle  )  [inline]

Copy constructor. Create a copy of a TAngle object. Copies are always shallow.

Parameters:
angle the object to be copied

Definition at line 390 of file angle.h.

template<typename T>
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.

Parameters:
new_value the value of the angle object
radian true if new_value is in radians, false otherwise

Definition at line 396 of file angle.h.

template<typename T>
virtual BALL::TAngle< T >::~TAngle (  )  [inline, virtual]

Destructor.

Definition at line 104 of file angle.h.


Member Function Documentation

template<typename T>
virtual void BALL::TAngle< T >::clear (  )  [inline, virtual]

Clear method The value is set to 0.

Definition at line 111 of file angle.h.

template<typename T >
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 .

Parameters:
s - output stream where to output the internal state of {*this}
depth - the dumping depth

Definition at line 689 of file angle.h.

template<typename T>
void BALL::TAngle< T >::get ( T &  val,
bool  radian = true 
) const [inline]

Assign the value to a variable of type T.

Parameters:
val the variable to assign the value to
radian if set to true assigns the value in radians (default).

Definition at line 446 of file angle.h.

template<typename T >
void BALL::TAngle< T >::get ( TAngle< T > &  angle  )  const [inline]

Assign the value to another angle.

Parameters:
angle the angle to assign the value to

Definition at line 440 of file angle.h.

template<typename T >
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.

Parameters:
angle the angle to compare with
Returns:
bool, true if {*this} angle is equal to value

Definition at line 672 of file angle.h.

template<typename T >
bool BALL::TAngle< T >::isValid (  )  const [inline]

Test whether instance is valid. Always returns true

Returns:
bool true

Definition at line 683 of file angle.h.

template<typename T >
void BALL::TAngle< T >::negate (  )  [inline]

Negate the angle

Definition at line 521 of file angle.h.

template<typename T >
void BALL::TAngle< T >::normalize ( Range  range  )  [inline]

Normalize the angle over a given range. RANGE__UNLIMITED = 0 no limitations. RANGE__UNSIGNED = 1 $0 \le \mathtt{angle} \le 360, 0 \le angle \le 2 \pi$. RANGE__SIGNED = 2 $-180 \le \mathtt{angle} \le 180, -\pi \le \mathtt{angle} \le \pi$.

Parameters:
range the range of the angle

Definition at line 486 of file angle.h.

template<typename T >
BALL::TAngle< T >::operator T (  )  const [inline]

Cast operator

Returns:
value in radians

Definition at line 454 of file angle.h.

template<typename T >
bool BALL::TAngle< T >::operator!= ( const TAngle< T > &  angle  )  const [inline]

Inequality operator This test uses Maths::isNotEqual instead of comparing the values directly.

Parameters:
angle the angle to compare with
Returns:
bool, true if the two angles are not equal

Definition at line 635 of file angle.h.

template<typename T>
TAngle< T > & BALL::TAngle< T >::operator*= ( const T &  val  )  [inline]

Multiply a value with this angle.

Parameters:
val the value to multiply by
Returns:
TAngle, {*this}

Definition at line 586 of file angle.h.

template<typename T >
TAngle< T > & BALL::TAngle< T >::operator*= ( const TAngle< T > &  angle  )  [inline]

Multiply an angle with this angle.

Parameters:
angle the angle to multiply by
Returns:
TAngle, {*this}

Definition at line 579 of file angle.h.

template<typename T >
TAngle< T > BALL::TAngle< T >::operator+ ( const TAngle< T > &  angle  )  [inline]

Addition operator.

Parameters:
angle the angle to add
Returns:
TAngle, the new angle

Definition at line 553 of file angle.h.

template<typename T >
TAngle< T > BALL::TAngle< T >::operator+ (  )  const [inline]

Positive sign.

Definition at line 527 of file angle.h.

template<typename T>
TAngle< T > & BALL::TAngle< T >::operator+= ( const T &  val  )  [inline]

Add a value to this angle.

Parameters:
val the value to add
Returns:
TAngle, {*this}

Definition at line 546 of file angle.h.

template<typename T >
TAngle< T > & BALL::TAngle< T >::operator+= ( const TAngle< T > &  angle  )  [inline]

Addition operator.

Parameters:
angle the angle to add
Returns:
TAngle, {*this}

Definition at line 539 of file angle.h.

template<typename T >
TAngle< T > BALL::TAngle< T >::operator- ( const TAngle< T > &  angle  )  [inline]

Subtraction an angle from this angle.

Parameters:
angle the angle to substract
Returns:
TAngle, the new angle

Definition at line 573 of file angle.h.

template<typename T >
TAngle< T > BALL::TAngle< T >::operator- (  )  const [inline]

Negative sign.

Definition at line 533 of file angle.h.

template<typename T>
TAngle< T > & BALL::TAngle< T >::operator-= ( const T &  val  )  [inline]

Substract a value from this angle.

Parameters:
val the value to substract
Returns:
TAngle, {*this}

Definition at line 566 of file angle.h.

template<typename T >
TAngle< T > & BALL::TAngle< T >::operator-= ( const TAngle< T > &  angle  )  [inline]

Substraction operator.

Parameters:
angle the angle to substract
Returns:
TAngle, {*this}

Definition at line 559 of file angle.h.

template<typename T >
TAngle< T > BALL::TAngle< T >::operator/ ( const TAngle< T > &  val  )  [inline]

Divide this angle by a value.

Parameters:
val the angle to divide by
Returns:
TAngle, the new angle
Exceptions:
Exception::DivisionByZero if val is zero

Definition at line 618 of file angle.h.

template<typename T>
TAngle< T > & BALL::TAngle< T >::operator/= ( const T &  val  )  [inline]

Divide this angle by a value.

Parameters:
val the angle to divide by
Returns:
TAngle, {*this}
Exceptions:
Exception::DivisionByZero if val is zero

Definition at line 605 of file angle.h.

template<typename T >
TAngle< T > & BALL::TAngle< T >::operator/= ( const TAngle< T > &  angle  )  [inline]

Division operator.

Parameters:
angle the angle to divide by
Returns:
TAngle, {*this}
Exceptions:
Exception::DivisionByZero if angle is zero

Definition at line 593 of file angle.h.

template<typename T>
bool BALL::TAngle< T >::operator< ( const T &  val  )  const [inline]

Is less operator. This test uses Maths::isLess instead of comparing the values directly.

Parameters:
val the value to compare with
Returns:
bool, true if {*this} angle is smaller than value

Definition at line 647 of file angle.h.

template<typename T >
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.

Parameters:
angle the angle to compare with
Returns:
bool, true if {*this} angle is smaller than value

Definition at line 641 of file angle.h.

template<typename T >
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.

Parameters:
angle the angle to compare with
Returns:
bool, true if {*this} angle is smaller or equal than value

Definition at line 653 of file angle.h.

template<typename T>
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!

Parameters:
new_value the new value

Definition at line 433 of file angle.h.

template<typename T >
TAngle< T > & BALL::TAngle< T >::operator= ( const TAngle< T > &  angle  )  [inline]

Assignment operator

Definition at line 426 of file angle.h.

template<typename T >
bool BALL::TAngle< T >::operator== ( const TAngle< T > &  angle  )  const [inline]

Equality operator. This test uses Maths::isEqual instead of comparing the values directly.

Parameters:
angle the angle to compare with
Returns:
bool, true if the two angles are equal

Definition at line 629 of file angle.h.

template<typename T >
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.

Parameters:
angle the angle to compare with
Returns:
bool, true if {*this} angle is greater than value

Definition at line 665 of file angle.h.

template<typename T >
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.

Parameters:
angle the angle to compare with
Returns:
bool, true if {*this} angle is greater or equal than value

Definition at line 659 of file angle.h.

template<typename T>
void BALL::TAngle< T >::set ( const TAngle< T > &  angle  )  [inline]

Assign an Angle object from another.

Parameters:
angle the angle object to be assigned from

Definition at line 412 of file angle.h.

template<typename T>
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.

Parameters:
new_value the value of the angle object
radian true if new_value is in radians, false otherwise

Definition at line 418 of file angle.h.

template<typename T >
void BALL::TAngle< T >::swap ( TAngle< T > &  angle  )  [inline]

Swap the contents of two angles.

Definition at line 404 of file angle.h.

template<typename T>
T BALL::TAngle< T >::toDegree ( const T &  radian  )  [inline, static]

Calculate degrees from radians

Parameters:
radian the value in radians
Returns:
T the value in degrees

Definition at line 479 of file angle.h.

template<typename T >
T BALL::TAngle< T >::toDegree (  )  const [inline]

Return the value of the angle

Returns:
value in degrees

Definition at line 472 of file angle.h.

template<typename T>
T BALL::TAngle< T >::toRadian ( const T &  degree  )  [inline, static]

Calculate radians from degrees

Parameters:
degree the value in degrees
Returns:
T the value in radians

Definition at line 466 of file angle.h.

template<typename T >
T BALL::TAngle< T >::toRadian (  )  const [inline]

Return the value of the angle

Returns:
value in radians

Definition at line 460 of file angle.h.


Member Data Documentation

template<typename T>
T BALL::TAngle< T >::value

The value

Definition at line 377 of file angle.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3