MIRA
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
SignedAngle< T > Class Template Reference

Signed angle that is represented using radians. More...

#include <math/Angle.h>

Inheritance diagram for SignedAngle< T >:
Inheritance graph
[legend]

Public Member Functions

template<typename Reflector >
void reflect (Reflector &r)
 
SignedAngle< T > smallestDifference (const SignedAngle &other) const
 Returns the signed difference angle between this angle and the specified other angle that has the smallest absolute value. More...
 
 MIRA_DEPRECATED ("use Radian<T>(value)", static SignedAngle fromRad(T value))
 deprecated, use Radian<T>(value) instead More...
 
 MIRA_DEPRECATED ("use Degree<T>(value)", static SignedAngle fromDeg(T value))
 deprecated, use Degree<T>(value) instead More...
 
void setValue (const T &value)
 Set the angle value. The input value is mapped into the angle interval. More...
 
const T & value () const
 Returns the raw angle value given in the native unit of the angle class. More...
 
 operator T () const
 Conversion function to native type (same as value() ) More...
 
void setSerializedValue (const T &value)
 Sets the value in the unit that is used for serialization. More...
 
serializedValue () const
 Returns the value in the unit that is used for serialization. More...
 
deg () const
 Returns the value of the angle in degrees. More...
 
rad () const
 Returns the value of the angle in radian. More...
 
SignedAngle< T > operator- () const
 Unary minus operator. More...
 
SignedAngle< T > operator+= (const AngleBase< T, OtherUnitTag, OtherDerived > &a)
 Add other angle to this angle. More...
 
SignedAngle< T > & operator+= (const T &a)
 Add float value to this angle. More...
 
SignedAngle< T > operator-= (const AngleBase< T, OtherUnitTag, OtherDerived > &a)
 Subtract other angle from this angle. More...
 
SignedAngle< T > & operator-= (const T &a)
 Subtract float value from this angle. More...
 
SignedAngle< T > & operator*= (const T &s)
 Multiply this angle with scalar. More...
 
SignedAngle< T > & operator/= (const T &s)
 Divide this angle by scalar. More...
 
smallestDifferenceValue (const SignedAngle< T > &other) const
 Returns the signed difference angle between this angle and the specified other angle that has the smallest absolute value. More...
 
bool isInInterval (const SignedAngle< T > &min, const SignedAngle< T > &max) const
 Returns true, if the angle is in the given interval [min,max]. More...
 

Static Public Member Functions

static T lower ()
 Returns the lower limit of the defined angle interval. More...
 
static T convertToSerialized (T value)
 Converts own representation to serialized representation. More...
 
static T convertFromSerialized (T value)
 Converts serialized representation to own representation. More...
 
static T turn ()
 Returns the amount of a turn (full circle) that is equal to 360 deg. More...
 
static T upper ()
 Returns the upper limit of the defined angle interval. More...
 
static const char * unit ()
 Returns the unit of this angle representation as string, e.g. More...
 

Protected Attributes

mValue
 the actual value More...
 

Friends

class Angle< T >
 

Detailed Description

template<typename T>
class mira::SignedAngle< T >

Signed angle that is represented using radians.

The values are normalized to the interval [-pi,pi). The class will take care that the values stay within this range, when operations and computations are performed.

This class is essentially the same as SignedRadian, except that the angles are serialized using degrees.

The values are interchangeable with other angle types, conversions will be done automatically between them.

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

◆ lower()

static T lower ( )
inlinestatic

Returns the lower limit of the defined angle interval.

Note, that the lower limit is included in the interval, hence the interval is [lower,upper) .

◆ smallestDifference()

SignedAngle<T> smallestDifference ( const SignedAngle< T > &  other) const
inline

Returns the signed difference angle between this angle and the specified other angle that has the smallest absolute value.

◆ MIRA_DEPRECATED() [1/2]

MIRA_DEPRECATED ( "use Radian<T>(value)"  ,
static SignedAngle< T >   fromRadT value 
)
inline

deprecated, use Radian<T>(value) instead

◆ MIRA_DEPRECATED() [2/2]

MIRA_DEPRECATED ( "use Degree<T>(value)"  ,
static SignedAngle< T >   fromDegT value 
)
inline

deprecated, use Degree<T>(value) instead

◆ convertToSerialized()

static T convertToSerialized ( value)
inlinestatic

Converts own representation to serialized representation.

◆ convertFromSerialized()

static T convertFromSerialized ( value)
inlinestatic

Converts serialized representation to own representation.

◆ turn()

static T turn ( )
inlinestaticinherited

Returns the amount of a turn (full circle) that is equal to 360 deg.

◆ upper()

static T upper ( )
inlinestaticinherited

Returns the upper limit of the defined angle interval.

Note, that the upper limit does not belong to the interval itself, hence the interval is [lower,upper) .

◆ setValue()

void setValue ( const T &  value)
inlineinherited

Set the angle value. The input value is mapped into the angle interval.

◆ value()

const T& value ( ) const
inlineinherited

Returns the raw angle value given in the native unit of the angle class.

◆ operator T()

operator T ( ) const
inlineexplicitinherited

Conversion function to native type (same as value() )

Implicit conversion is intentionally disabled, in order to prevent potentially erroneous usage like

Angle a = 2;
T f = 5;
T r = a * f; // r is (T)Angle(2*5), which is NOT 2*5

◆ setSerializedValue()

void setSerializedValue ( const T &  value)
inlineinherited

Sets the value in the unit that is used for serialization.

The Angle and SignedAngle classes use radians for storing the value internal and degrees for serializing the value to simplify the usage for the human user. For the other classes Degree, SignedDegree, Radian and SignedRadian setValue() and setSerializedValue() are doing the same.

◆ serializedValue()

T serializedValue ( ) const
inlineinherited

Returns the value in the unit that is used for serialization.

The Angle and SignedAngle classes use radians for storing the value internal and degrees for serializing the value to simplify the usage for the human user. For the other classes Degree, SignedDegree, Radian and SignedRadian value() and serializedValue() yield the same result.

◆ deg()

T deg ( ) const
inlineinherited

Returns the value of the angle in degrees.

◆ rad()

T rad ( ) const
inlineinherited

Returns the value of the angle in radian.

◆ operator-()

SignedAngle< T > operator- ( ) const
inlineinherited

Unary minus operator.

◆ operator+=() [1/2]

SignedAngle< T > operator+= ( const AngleBase< T, OtherUnitTag, OtherDerived > &  a)
inlineinherited

Add other angle to this angle.

◆ operator+=() [2/2]

SignedAngle< T > & operator+= ( const T &  a)
inlineinherited

Add float value to this angle.

◆ operator-=() [1/2]

SignedAngle< T > operator-= ( const AngleBase< T, OtherUnitTag, OtherDerived > &  a)
inlineinherited

Subtract other angle from this angle.

◆ operator-=() [2/2]

SignedAngle< T > & operator-= ( const T &  a)
inlineinherited

Subtract float value from this angle.

◆ operator*=()

SignedAngle< T > & operator*= ( const T &  s)
inlineinherited

Multiply this angle with scalar.

◆ operator/=()

SignedAngle< T > & operator/= ( const T &  s)
inlineinherited

Divide this angle by scalar.

◆ smallestDifferenceValue()

T smallestDifferenceValue ( const SignedAngle< T > &  other) const
inlineinherited

Returns the signed difference angle between this angle and the specified other angle that has the smallest absolute value.

This method is similar to smallestDifference() but returns a floating point value instead of a signed angle class object.

◆ isInInterval()

bool isInInterval ( const SignedAngle< T > &  min,
const SignedAngle< T > &  max 
) const
inlineinherited

Returns true, if the angle is in the given interval [min,max].

If max<min, both values will be swapped.

◆ unit()

static const char* unit ( )
inlinestaticinherited

Returns the unit of this angle representation as string, e.g.

"rad" or "deg"

Friends And Related Function Documentation

◆ Angle< T >

friend class Angle< T >
friend

Member Data Documentation

◆ mValue

T mValue
protectedinherited

the actual value


The documentation for this class was generated from the following file: