Class Angle#

Class Documentation#

class Angle#

Mathmatical angle representation.

Angle is a wrapper class for angle values. Angles are stored as radian values. For consistence, its value needs to be in [0,2*pi].

Author

beyss

Date

03.07.2017

Public Functions

inline Angle(double angle)#

constructor

Creates a Angle from an angle value. If necessary, the value is corrected to be consistent.

Parameters:

angle – the angle value

inline double value() const#

Returns the value of this angle.

Returns:

the angle value

inline double operator=(double angle)#

Assignment operator setting this Angle’s value. If necessary, the value is corrected to be consistent.

Parameters:

angle – the angle value in radians

Returns:

the adjusted angle value

inline bool operator==(const Angle &rhs) const#

Equal to operator checking wether this Angle’s value is equal to the other Angle’s value.

Parameters:

rhs – the other Angle

Returns:

if equal or not

inline bool operator<(const Angle &rhs) const#

Smaller than operator checking wether this Angle’s value is smaller than the other Angle’s value.

Parameters:

rhs – the other Angle

Returns:

if smaller than or not

inline bool operator<=(const Angle &rhs) const#

Smaller than or equal to operator checking wether this Angle’s value is smaller than or equal to the other Angle’s value.

Parameters:

rhs – the other Angle

Returns:

if smaller than or equal or not

inline bool operator>(const Angle &rhs) const#

Greater than operator checking wether this Angle’s value is greater than the other Angle’s value.

Parameters:

rhs – the other Angle

Returns:

if greater than or not

inline bool operator>=(const Angle &rhs) const#

Greater than or equal to operator checking wether this Angle’s value is smaller than or equal to the other Angle’s value.

Parameters:

rhs – the other Angle

Returns:

if greater than or equal or not

inline Angle &operator+=(const Angle &rhs)#

Addition assignment operator increasing this Angle’s value by the other Angle’s value. If necessary, the value is corrected to be consistent.

Parameters:

rhs – the other Angle

Returns:

a reference to this angle

inline Angle operator+(const Angle &rhs) const#

this + rhs

Friend addition operator returning an Angle equal to the return of this += rhs. It operates on a copy of lhs so that the original object is not changed.

Parameters:

rhs – the right operand Angle

Returns:

a new Angle equal to this + rhs

inline Angle &operator-=(const Angle &rhs)#

Subtraction assignment operator decreasing this Angle’s value by the other Angle’s value. If necessary, the value is corrected to be consistent.

Parameters:

rhs – the other angle

Returns:

a reference to this angle

inline Angle operator-(const Angle &rhs) const#

this - rhs

Friend addition operator returning an Angle equal to the return of this - rhs. It operates on a copy of lhs so that the original object is not changed.

Parameters:

rhs – the right operand Angle

Returns:

a new Angle equal to this - rhs

inline Angle &operator*=(double val)#

Multiplication assignment operator multiplying this Angle’s value with the given double value. If necessary, the value is corrected to be consistent.

Parameters:

rhs – the factor

Returns:

a reference to this angle

inline Angle operator*(double val) const#

Multiplication operator returning an Angle with the value of adjusted this * val.

Parameters:

val – the factor

Returns:

a new Angle equal to this * val

inline Angle &operator/=(double val)#

Division assignment operator divides this Angle’s value by the given double value. If necessary, the value is corrected to be consistent.

Parameters:

val – the dividend

Returns:

a reference to this angle

inline Angle operator/(double val)#

Division operator returning an Angle with the value of adjusted this / val.

Parameters:

val – the dividend

Returns:

a new Angle equal to this / val

Public Static Functions

static inline Angle interpolate(const Angle &a1, const Angle &a2, double p)#

Returns an Angle that is (1-p) percent of a1 and p percent of a2. To be consistent, p should be in [0,1].

Parameters:
  • a1 – the first angle

  • a2 – the second angle

  • p – the percentage

Returns:

the interpolated Angle

static inline Angle center(const Angle &a1, const Angle &a2)#

Returns the Angle in the center of two given Angles.

Parameters:
Returns:

the centered Angle