LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst::afw::geom::CoordinateBase< Derived, T, N > Class Template Reference

A CRTP base class for coordinate objects. More...

#include <CoordinateBase.h>

Inheritance diagram for lsst::afw::geom::CoordinateBase< Derived, T, N >:
lsst::afw::geom::ExtentBase< double, N > lsst::afw::geom::ExtentBase< int, N >

Public Types

typedef T Element
 
typedef Eigen::Matrix< T, N,
1, Eigen::DontAlign > 
EigenVector
 

Public Member Functions

T & operator[] (int n)
 
T const & operator[] (int n) const
 
T & coeffRef (int n)
 
T const & coeffRef (int n) const
 
EigenVector const & asEigen () const
 Return a fixed-size Eigen representation of the coordinate object. More...
 

Static Public Attributes

static int const dimensions = N
 

Protected Member Functions

 CoordinateBase (T val=static_cast< T >(0))
 Initialize all elements to a scalar. More...
 
template<typename Vector >
 CoordinateBase (Eigen::MatrixBase< Vector > const &vector)
 Initialize all elements from an N-d Eigen vector. More...
 
void _swap (CoordinateBase &other)
 

Protected Attributes

EigenVector _vector
 

Detailed Description

template<typename Derived, typename T, int N>
class lsst::afw::geom::CoordinateBase< Derived, T, N >

A CRTP base class for coordinate objects.

CoordinateBase has partial specializations for 2 and 3 dimensions so its subclasses don't have to.

Definition at line 49 of file CoordinateBase.h.

Member Typedef Documentation

template<typename Derived, typename T, int N>
typedef Eigen::Matrix<T,N,1,Eigen::DontAlign> lsst::afw::geom::CoordinateBase< Derived, T, N >::EigenVector

Definition at line 53 of file CoordinateBase.h.

template<typename Derived, typename T, int N>
typedef T lsst::afw::geom::CoordinateBase< Derived, T, N >::Element

Definition at line 51 of file CoordinateBase.h.

Constructor & Destructor Documentation

template<typename Derived, typename T, int N>
lsst::afw::geom::CoordinateBase< Derived, T, N >::CoordinateBase ( val = static_cast<T>(0))
inlineexplicitprotected

Initialize all elements to a scalar.

A public constructor with the same signature is expected for subclasses.

Definition at line 78 of file CoordinateBase.h.

78 : _vector(EigenVector::Constant(val)) {}
bool val
template<typename Derived, typename T, int N>
template<typename Vector >
lsst::afw::geom::CoordinateBase< Derived, T, N >::CoordinateBase ( Eigen::MatrixBase< Vector > const &  vector)
inlineexplicitprotected

Initialize all elements from an N-d Eigen vector.

A public constructor with the same signature is expected for subclasses.

Definition at line 86 of file CoordinateBase.h.

86 : _vector(vector) {}

Member Function Documentation

template<typename Derived, typename T, int N>
void lsst::afw::geom::CoordinateBase< Derived, T, N >::_swap ( CoordinateBase< Derived, T, N > &  other)
inlineprotected

Definition at line 88 of file CoordinateBase.h.

88 {_vector.swap(other._vector);}
template<typename Derived, typename T, int N>
EigenVector const& lsst::afw::geom::CoordinateBase< Derived, T, N >::asEigen ( ) const
inline

Return a fixed-size Eigen representation of the coordinate object.

The fact that this returns by const reference rather than by value should not be considered part of the API; this is merely an optimization enabled by the implementation.

Definition at line 67 of file CoordinateBase.h.

67 { return _vector; }
template<typename Derived, typename T, int N>
T& lsst::afw::geom::CoordinateBase< Derived, T, N >::coeffRef ( int  n)
inline

Definition at line 58 of file CoordinateBase.h.

58 { return _vector.coeffRef(n); }
template<typename Derived, typename T, int N>
T const& lsst::afw::geom::CoordinateBase< Derived, T, N >::coeffRef ( int  n) const
inline

Definition at line 59 of file CoordinateBase.h.

59 { return const_cast<EigenVector&>(_vector).coeffRef(n); }
Eigen::Matrix< T, N, 1, Eigen::DontAlign > EigenVector
template<typename Derived, typename T, int N>
T& lsst::afw::geom::CoordinateBase< Derived, T, N >::operator[] ( int  n)
inline

Definition at line 56 of file CoordinateBase.h.

56 { return _vector[n]; }
template<typename Derived, typename T, int N>
T const& lsst::afw::geom::CoordinateBase< Derived, T, N >::operator[] ( int  n) const
inline

Definition at line 57 of file CoordinateBase.h.

57 { return const_cast<EigenVector&>(_vector)[n]; }
Eigen::Matrix< T, N, 1, Eigen::DontAlign > EigenVector

Member Data Documentation

template<typename Derived, typename T, int N>
EigenVector lsst::afw::geom::CoordinateBase< Derived, T, N >::_vector
protected

Definition at line 89 of file CoordinateBase.h.

template<typename Derived, typename T, int N>
int const lsst::afw::geom::CoordinateBase< Derived, T, N >::dimensions = N
static

Definition at line 52 of file CoordinateBase.h.


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