Interface for angular measurements. More...
#include <angle.hpp>
Public Types | |
typedef ecl::linear_algebra::Matrix< T, 2, 2 > | RotationMatrix |
Public Member Functions | |
Angle (const T &angle=0.0) | |
Constructs an angle in radians. | |
Angle (const RotationMatrix &rotation) | |
Construct from a 2x2 rotation matrix. | |
T | degrees () |
Returns the value of the angle in unit degrees. | |
operator const T & () const | |
Convenient equivalence to the c/c++ float type. | |
Angle< T > | operator* (const T &scalar) const |
Multiplier. | |
void | operator*= (const T &scalar) |
Multiplier that works on this instance. | |
Angle< T > | operator+ (const T &angle) const |
Sum operator. | |
Angle< T > | operator+ (const Angle< T > &angle) const |
Sum operator. | |
void | operator+= (const T &angle) |
Sum operator that works on this instance. | |
void | operator+= (const Angle< T > &angle) |
Sum operator that works on this instance. | |
Angle< T > | operator- (const T &angle) const |
Difference operator. | |
Angle< T > | operator- (const Angle< T > &angle) const |
Difference operator. | |
void | operator-= (const T &angle) |
Difference operator that works on this instance. | |
void | operator-= (const Angle< T > &angle) |
Difference operator that works on this instance. | |
const Angle< T > & | operator= (const T &angle) |
Allow assignment from float types. | |
RotationMatrix | rotationMatrix () const |
Convert to a 2x2 rotation matrix. | |
Static Public Member Functions | |
static Angle< T > | Degrees (const T &angle) |
Generates an angle instance from an angle in degrees. | |
static Angle< T > | Radians (const T &angle) |
Generates an angle instance from an angle in radians. | |
Private Attributes | |
T | value |
Interface for angular measurements.
This is a simple interface designed for scientific calculations (thus the default format is in radians). It allows free interaction with float types, does automatic wrapping on [-pi, pi] under the hood and provides some generic methods for conversions and wrapping on plain double types.
T | : must be a float type (e.g. float, double, float32, float64) |
typedef ecl::linear_algebra::Matrix<T,2,2> ecl::Angle< T, enable_if< is_float< T > >::type >::RotationMatrix |
ecl::Angle< T, enable_if< is_float< T > >::type >::Angle | ( | const T & | angle = 0.0 | ) | [inline] |
ecl::Angle< T, enable_if< is_float< T > >::type >::Angle | ( | const RotationMatrix & | rotation | ) | [inline] |
T ecl::Angle< T, enable_if< is_float< T > >::type >::degrees | ( | ) |
Returns the value of the angle in unit degrees.
This does not change the internal formatting for the angle (which is in radians). It simply returns its equivalent in unit degrees. The returned value will be wrapped on [-180, 180].
static Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::Degrees | ( | const T & | angle | ) | [static] |
ecl::Angle< T, enable_if< is_float< T > >::type >::operator const T & | ( | ) | const [inline] |
Convenient equivalence to the c/c++ float type.
Allows for easy manipulation, especially within calculations. This breaks the rule which dictates that we should never use them as they create uncertainty about an object. Here it's just ridiculously convenient and more to the point, intuitive, so we do so.
Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::operator* | ( | const T & | scalar | ) | const |
Multiplier.
Note this also ensures the angle is wrapped.
scalar | : scalar multipler to apply. |
void ecl::Angle< T, enable_if< is_float< T > >::type >::operator*= | ( | const T & | scalar | ) |
Multiplier that works on this instance.
Note this also ensures the angle is wrapped.
scalar | : scalar multipler to apply. |
Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::operator+ | ( | const T & | angle | ) | const |
Sum operator.
Note this also ensures the angle is wrapped.
angle | : angle to add (radians). |
Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::operator+ | ( | const Angle< T > & | angle | ) | const |
Sum operator.
Note this also ensures the angle is wrapped.
angle | : angle to add (radians). |
void ecl::Angle< T, enable_if< is_float< T > >::type >::operator+= | ( | const T & | angle | ) |
Sum operator that works on this instance.
Note this also ensures the angle is wrapped.
angle | : angle to add (radians). |
void ecl::Angle< T, enable_if< is_float< T > >::type >::operator+= | ( | const Angle< T > & | angle | ) |
Sum operator that works on this instance.
Note this also ensures the angle is wrapped.
angle | : angle to add (radians). |
Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::operator- | ( | const T & | angle | ) | const |
Difference operator.
Note this also ensures the angle is wrapped.
angle | : angle to subtract (radians). |
Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::operator- | ( | const Angle< T > & | angle | ) | const |
Difference operator.
Note this also ensures the angle is wrapped.
angle | : angle to subtract (radians). |
void ecl::Angle< T, enable_if< is_float< T > >::type >::operator-= | ( | const T & | angle | ) |
Difference operator that works on this instance.
Note this also ensures the angle is wrapped.
angle | : angle to subtract (radians). |
void ecl::Angle< T, enable_if< is_float< T > >::type >::operator-= | ( | const Angle< T > & | angle | ) |
Difference operator that works on this instance.
Note this also ensures the angle is wrapped.
angle | : angle to subtract (radians). |
const Angle<T>& ecl::Angle< T, enable_if< is_float< T > >::type >::operator= | ( | const T & | angle | ) |
Allow assignment from float types.
This allows convenient assignment from float types. It does automatic wrapping on the input value.
angle | : input angle (radians). |
static Angle<T> ecl::Angle< T, enable_if< is_float< T > >::type >::Radians | ( | const T & | angle | ) | [static] |
RotationMatrix ecl::Angle< T, enable_if< is_float< T > >::type >::rotationMatrix | ( | ) | const [inline] |
T ecl::Angle< T, enable_if< is_float< T > >::type >::value [private] |