mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
cyclic.h File Reference

Defines the cyclic class for calculations with cyclic quantities. More...

#include <cmath>
#include <ostream>
+ Include dependency graph for cyclic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mrs_lib::geometry::cyclic< flt, spec >
 Implementation of the a general cyclic value (such as angles in radians/degrees etc). More...
 
struct  mrs_lib::geometry::radians
 Convenience specialization of the cyclic class for unsigned radians (from $0$ to $2\pi$). More...
 
struct  mrs_lib::geometry::sradians
 Convenience specialization of the cyclic class for signed radians (from $-\pi$ to $\pi$). More...
 
struct  mrs_lib::geometry::degrees
 Convenience specialization of the cyclic class for unsigned degrees (from $0$ to $360$). More...
 
struct  mrs_lib::geometry::sdegrees
 Convenience specialization of the cyclic class for signed degrees (from $-180$ to $180$). More...
 

Namespaces

 mrs_lib
 All mrs_lib functions, classes, variables and definitions are contained in this namespace.
 

Functions

template<typename flt , class spec >
bool mrs_lib::geometry::operator< (const cyclic< flt, spec > &lhs, const cyclic< flt, spec > &rhs)
 Implementation of the comparison operation between two angles. More...
 
template<typename flt , class spec >
bool mrs_lib::geometry::operator> (const cyclic< flt, spec > &lhs, const cyclic< flt, spec > &rhs)
 Implementation of the comparison operation between two angles. More...
 
template<typename flt , class spec >
std::ostream & mrs_lib::geometry::operator<< (std::ostream &out, const cyclic< flt, spec > &ang)
 Implementation of the stream output operator. More...
 

Detailed Description

Defines the cyclic class for calculations with cyclic quantities.

Author
Matouš Vrba - vrbam.nosp@m.ato@.nosp@m.fel.c.nosp@m.vut..nosp@m.cz

Function Documentation

◆ operator<()

template<typename flt , class spec >
bool mrs_lib::geometry::operator< ( const cyclic< flt, spec > &  lhs,
const cyclic< flt, spec > &  rhs 
)

Implementation of the comparison operation between two angles.

An angle is considered to be smaller than another angle if it is shorter - closer to zero.

Parameters
lhsleft-hand-side.
rhsright-hand-side.
Returns
true iff the shortest unsigned walk from lhs to 0 is less than from rhs to 0.

◆ operator<<()

template<typename flt , class spec >
std::ostream& mrs_lib::geometry::operator<< ( std::ostream &  out,
const cyclic< flt, spec > &  ang 
)

Implementation of the stream output operator.

Parameters
outthe stream to write the angle to.
angthe angle to be written.
Returns
a reference to the stream.

◆ operator>()

template<typename flt , class spec >
bool mrs_lib::geometry::operator> ( const cyclic< flt, spec > &  lhs,
const cyclic< flt, spec > &  rhs 
)

Implementation of the comparison operation between two angles.

An angle is considered to be larger than another angle if it is longer - further from zero.

Parameters
lhsleft-hand-side.
rhsright-hand-side.
Returns
true iff the shortest unsigned walk from lhs to 0 is more than from rhs to 0.