Horizon
Loading...
Searching...
No Matches
horizon::Coord< T > Class Template Reference

Your typical coordinate class. More...

#include <common.hpp>

Public Types

using type = T

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
Coord< T > rotate (T a) const
Coord< int64_t > to_coordi () const
dot (const Coord< T > &a) const
cross (const Coord< T > &other) const
mag_sq () const
mag () const
Coord< T > normalize () const
double magd () const
std::conditional_t< std::is_same_v< T, float >, float, double > angle () 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< T > euler (T r, T 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()

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()

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

◆ mag_sq()

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

◆ max()

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

◆ min()

template<typename T>
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: