base
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
base::Angle Class Reference

#include <Angle.hpp>

Public Member Functions

 Angle ()
 
double getRad () const
 
double getDeg () const
 
bool isApprox (Angle other, double prec=1e-5) const
 
void operator= (const Angle &other)
 
bool operator== (const Angle &other) const
 
bool operator< (const Angle &other) const
 
bool operator> (const Angle &other) const
 
bool operator<= (const Angle &other) const
 
bool operator>= (const Angle &other) const
 
Angleoperator+= (const Angle &other)
 
Angleoperator-= (const Angle &other)
 
Angle operator+ (const Angle &other) const
 
Angle operator- (const Angle &other) const
 
Angle operator* (const Angle &other) const
 
Angle operator* (const double &val) const
 
Angle flipped () const
 
Angleflip ()
 

Static Public Member Functions

static double rad2Deg (double rad)
 
static double deg2Rad (double deg)
 
static double normalizeRad (double rad)
 
static Angle fromRad (double rad)
 
static Angle fromDeg (double deg)
 
static Angle unknown ()
 
static Angle Min ()
 
static Angle Max ()
 
static Angle vectorToVector (const base::Vector3d &a, const base::Vector3d &b)
 
static Angle vectorToVector (const base::Vector3d &a, const base::Vector3d &b, const base::Vector3d &positive)
 

Public Attributes

double rad
 

Protected Member Functions

 Angle (double _rad)
 
void canonize ()
 

Detailed Description

This class represents an angle, and can be used instead of double for convenience. The class has a canonical representation of the angle in degrees, in the interval PI < rad <= PI.

Constructor & Destructor Documentation

◆ Angle() [1/2]

base::Angle::Angle ( )
inline

default constructor, which will initialize the value to unknown (NaN)

◆ Angle() [2/2]

base::Angle::Angle ( double  _rad)
inlineexplicitprotected

Member Function Documentation

◆ canonize()

void base::Angle::canonize ( )
inlineprotected

◆ deg2Rad()

static double base::Angle::deg2Rad ( double  deg)
inlinestatic

static conversion from degree to radians

Parameters
degangle in degree
Returns
angle in radians

◆ flip()

Angle& base::Angle::flip ( )
inline

Inverts the current angle

◆ flipped()

Angle base::Angle::flipped ( ) const
inline

Returns a new angle which is the inverse of tis object.

◆ fromDeg()

static Angle base::Angle::fromDeg ( double  deg)
inlinestatic

use this method to get an angle from degrees.

Returns
representation of the given angle.
Parameters
deg- angle in degrees.

◆ fromRad()

static Angle base::Angle::fromRad ( double  rad)
inlinestatic

use this method to get an angle from radians.

Returns
representation of the given angle.
Parameters
rad- angle in radians.

◆ getDeg()

double base::Angle::getDeg ( ) const
inline
Returns
canonical value of the angle in degrees

◆ getRad()

double base::Angle::getRad ( ) const
inline
Returns
canonical value of the angle in radians

◆ isApprox()

bool base::Angle::isApprox ( Angle  other,
double  prec = 1e-5 
) const
inline

compare two angles for approximate equality

Parameters
other- angle to compare
prec- precision interval in deg
Returns
true if angle is approximately equal

◆ Max()

static Angle base::Angle::Max ( )
inlinestatic

Returns the maximum angle possible after normalization

Returns
representation of the maximum angle

◆ Min()

static Angle base::Angle::Min ( )
inlinestatic

Returns the minimum angle possible after normalization

Returns
representation of the minimum angle

◆ normalizeRad()

static double base::Angle::normalizeRad ( double  rad)
inlinestatic

Normalize an angular value in [-pi; pi] and returns it as double

◆ operator*() [1/2]

Angle base::Angle::operator* ( const Angle other) const
inline

◆ operator*() [2/2]

Angle base::Angle::operator* ( const double &  val) const
inline

◆ operator+()

Angle base::Angle::operator+ ( const Angle other) const
inline

◆ operator+=()

Angle& base::Angle::operator+= ( const Angle other)
inline

◆ operator-()

Angle base::Angle::operator- ( const Angle other) const
inline

◆ operator-=()

Angle& base::Angle::operator-= ( const Angle other)
inline

◆ operator<()

bool base::Angle::operator< ( const Angle other) const
inline

◆ operator<=()

bool base::Angle::operator<= ( const Angle other) const
inline

◆ operator=()

void base::Angle::operator= ( const Angle other)
inline

◆ operator==()

bool base::Angle::operator== ( const Angle other) const
inline

◆ operator>()

bool base::Angle::operator> ( const Angle other) const
inline

◆ operator>=()

bool base::Angle::operator>= ( const Angle other) const
inline

◆ rad2Deg()

static double base::Angle::rad2Deg ( double  rad)
inlinestatic

static conversion from radians to degree

Parameters
radangle in radians
Returns
angle in degree

◆ unknown()

static Angle base::Angle::unknown ( )
inlinestatic

Use this method to represent an unknown angle

◆ vectorToVector() [1/2]

Angle base::Angle::vectorToVector ( const base::Vector3d a,
const base::Vector3d b 
)
static

Computes the unsigned angle of the rotation that makes +a+ colinear with +b+

◆ vectorToVector() [2/2]

Angle base::Angle::vectorToVector ( const base::Vector3d a,
const base::Vector3d b,
const base::Vector3d positive 
)
static

Computes the angle of the rotation that makes +a+ colinear with +b+

Unlike vectorToVector(a, b), this method computes a signed angle, with the positive vector defining the positive rotation direction. positive is required to be of unit length.

Member Data Documentation

◆ rad

double base::Angle::rad

angle in radians. this value will always be PI < rad <= PI

Note
don't use this value directly. It's only public to allow this class to be used as an interface type.

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