Horizon
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
horizon::Coord< T > Class Template Reference

Your typical coordinate class. More...

#include <common.hpp>

Public Member Functions

 Coord (T ix, T iy)
 
 Coord (std::vector< T > v)
 
 operator Coord< float > () const
 
 operator Coord< double > () const
 
Coord< T > operator+ (const Coord< T > &a) const
 
Coord< T > operator- (const Coord< T > &a) const
 
Coord< T > operator* (const Coord< T > &a) const
 
Coord< T > operator* (T r) const
 
Coord< T > operator/ (T r) const
 
bool operator== (const Coord< T > &a) const
 
bool operator!= (const Coord< T > &a) const
 
bool operator< (const Coord< T > &a) const
 
dot (const Coord< T > &a) const
 
mag_sq () const
 
bool in_range (const Coord< T > &a, const Coord< T > &b) const
 
void operator+= (const Coord< T > a)
 
void operator-= (const Coord< T > a)
 
void operator*= (T a)
 
std::array< T, 2 > as_array () const
 
 Coord (T ix, T iy)
 
 Coord (std::vector< T > v)
 
 operator Coord< float > () const
 
 operator Coord< double > () const
 
Coord< T > operator+ (const Coord< T > &a) const
 
Coord< T > operator- (const Coord< T > &a) const
 
Coord< T > operator* (const Coord< T > &a) const
 
Coord< T > operator* (T r) const
 
Coord< T > operator/ (T r) const
 
bool operator== (const Coord< T > &a) const
 
bool operator!= (const Coord< T > &a) const
 
bool operator< (const Coord< T > &a) const
 
dot (const Coord< T > &a) const
 
mag_sq () const
 
bool in_range (const Coord< T > &a, const Coord< T > &b) const
 
void operator+= (const Coord< T > a)
 
void operator-= (const Coord< T > a)
 
void operator*= (T a)
 
std::array< T, 2 > as_array () const
 

Static Public Member Functions

static Coord< T > min (const Coord< T > &a, const Coord< T > &b)
 
static Coord< T > max (const Coord< T > &a, const Coord< T > &b)
 
static Coord< float > euler (float r, float phi)
 
static Coord< T > min (const Coord< T > &a, const Coord< T > &b)
 
static Coord< T > max (const Coord< T > &a, const Coord< T > &b)
 
static Coord< float > euler (float r, float phi)
 

Public Attributes

x
 
y
 

Detailed Description

template<typename T>
class horizon::Coord< T >

Your typical coordinate class.

Supports some mathematical operators as required. Unless otherwise noted, 1 equals 1 nm (that is nanometer, not nautical mile) Instead of instantiating the template on your own, you want to use Coordf (float) for calculations that will end up only on screen and Coordi (int64_t) for everything else.

Member Function Documentation

◆ dot() [1/2]

template<typename T >
T horizon::Coord< T >::dot ( const Coord< T > &  a) const
inline
Parameters
aother coordinate
Returns
dot product of a and this

◆ dot() [2/2]

template<typename T >
T horizon::Coord< T >::dot ( const Coord< T > &  a) const
inline
Parameters
aother coordinate
Returns
dot product of a and this

◆ euler() [1/2]

template<typename T >
static Coord<float> horizon::Coord< T >::euler ( float  r,
float  phi 
)
inlinestatic
Parameters
rmagnitude
phiangle in radians
Returns
coordinate specified by r and phi

◆ euler() [2/2]

template<typename T >
static Coord<float> horizon::Coord< T >::euler ( float  r,
float  phi 
)
inlinestatic
Parameters
rmagnitude
phiangle in radians
Returns
coordinate specified by r and phi

◆ mag_sq() [1/2]

template<typename T >
T horizon::Coord< T >::mag_sq ( ) const
inline
Returns
squared magnitude of this

◆ mag_sq() [2/2]

template<typename T >
T horizon::Coord< T >::mag_sq ( ) const
inline
Returns
squared magnitude of this

◆ max() [1/2]

template<typename T >
static Coord<T> horizon::Coord< T >::max ( const Coord< T > &  a,
const Coord< T > &  b 
)
inlinestatic
Returns
element-wise maximum of a and b

◆ max() [2/2]

template<typename T >
static Coord<T> horizon::Coord< T >::max ( const Coord< T > &  a,
const Coord< T > &  b 
)
inlinestatic
Returns
element-wise maximum of a and b

◆ min() [1/2]

template<typename T >
static Coord<T> horizon::Coord< T >::min ( const Coord< T > &  a,
const Coord< T > &  b 
)
inlinestatic
Returns
element-wise minimum of a and b

◆ min() [2/2]

template<typename T >
static Coord<T> horizon::Coord< T >::min ( const Coord< T > &  a,
const Coord< T > &  b 
)
inlinestatic
Returns
element-wise minimum of a and b

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