OpenMS  2.8.0
Public Types | List of all members
DPosition< D, TCoordinateType > Class Template Reference

Representation of a coordinate in D-dimensional space. More...

#include <OpenMS/DATASTRUCTURES/DPosition.h>

Inheritance diagram for DPosition< D, TCoordinateType >:
[legend]
Collaboration diagram for DPosition< D, TCoordinateType >:
[legend]

Public Types

enum  { DIMENSION = D }
 Dimensions. More...
 
typedef TCoordinateType CoordinateType
 Coordinate type. More...
 
typedef CoordinateTypeIterator
 Mutable iterator. More...
 
typedef const CoordinateTypeConstIterator
 Non-mutable iterator. More...
 
STL compatibility type definitions
typedef CoordinateType value_type
 
typedef CoordinateTypereference
 
typedef CoordinateTypepointer
 
typedef CoordinateTypeiterator
 
typedef const CoordinateTypeconst_iterator
 

Public Member Functions

Constructors and Destructor
 DPosition ()
 Default constructor. More...
 
 ~DPosition ()
 Destructor (not-virtual as this will save a lot of space!) More...
 
 DPosition (CoordinateType x)
 Constructor that fills all dimensions with the value x. More...
 
 DPosition (const DPosition &pos)
 Copy constructor. More...
 
 DPosition (DPosition &&rhs) noexcept
 Move constructor. More...
 
 DPosition (CoordinateType x, CoordinateType y)
 Constructor only for DPosition<2> that takes two Coordinates. More...
 
DPositionoperator= (const DPosition &source)
 Assignment operator. More...
 

Static Public Member Functions

Static values
static const DPosition zero ()
 all zero More...
 
static const DPosition minPositive ()
 smallest positive More...
 
static const DPosition minNegative ()
 smallest negative More...
 
static const DPosition maxPositive ()
 largest positive More...
 

Iteration

CoordinateType coordinate_ [D]
 
ConstIterator begin () const
 Non-mutable begin iterator. More...
 
ConstIterator end () const
 Non-mutable end iterator. More...
 
Iterator begin ()
 Mutable begin iterator. More...
 
Iterator end ()
 Mutable end iterator. More...
 

Accessors

CoordinateType operator[] (Size index) const
 Const accessor for the dimensions. More...
 
CoordinateTypeoperator[] (Size index)
 Accessor for the dimensions. More...
 
CoordinateType getX () const
 Name accessor for the first dimension. Only for DPosition<2>, for visualization. More...
 
CoordinateType getY () const
 Name accessor for the second dimension. Only for DPosition<2>, for visualization. More...
 
void setX (CoordinateType c)
 Name mutator for the first dimension. Only for DPosition<2>, for visualization. More...
 
void setY (CoordinateType c)
 Name mutator for the second dimension. Only for DPosition<2>, for visualization. More...
 
bool operator== (const DPosition &point) const
 Equality operator. More...
 
bool operator!= (const DPosition &point) const
 Equality operator. More...
 
bool operator< (const DPosition &point) const
 Lexicographical less than operator. Lexicographical comparison from dimension 0 to dimension D-1 is done. More...
 
bool operator<= (const DPosition &point) const
 Lexicographical greater less or equal operator. More...
 
bool spatiallyLessEqual (const DPosition &point) const
 Spatially (geometrically) less or equal operator. All coordinates must be "<=". More...
 
bool spatiallyGreaterEqual (const DPosition &point) const
 Spatially (geometrically) greater or equal operator. All coordinates must be ">=". More...
 
bool operator> (const DPosition &point) const
 Lexicographical greater than operator. More...
 
bool operator>= (const DPosition &point) const
 Lexicographical greater or equal operator. More...
 
DPosition operator+ (const DPosition &point) const
 Addition (a bit inefficient) More...
 
DPositionoperator+= (const DPosition &point)
 Addition. More...
 
DPosition operator- (const DPosition &point) const
 Subtraction (a bit inefficient) More...
 
DPositionoperator-= (const DPosition &point)
 Subtraction. More...
 
DPosition operator- () const
 Negation (a bit inefficient) More...
 
CoordinateType operator* (const DPosition &point) const
 Inner product. More...
 
DPositionoperator*= (CoordinateType scalar)
 Scalar multiplication. More...
 
DPositionoperator/= (CoordinateType scalar)
 Scalar division. More...
 
void clear ()
 Set all dimensions to zero. More...
 
static Size size ()
 Returns the number of dimensions. More...
 

Detailed Description

template<UInt D, typename TCoordinateType = double>
class OpenMS::DPosition< D, TCoordinateType >

Representation of a coordinate in D-dimensional space.

Member Typedef Documentation

◆ const_iterator

◆ ConstIterator

typedef const CoordinateType* ConstIterator

Non-mutable iterator.

◆ CoordinateType

typedef TCoordinateType CoordinateType

Coordinate type.

◆ Iterator

Mutable iterator.

◆ iterator

◆ pointer

◆ reference

◆ value_type

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Dimensions.

Enumerator
DIMENSION 

Constructor & Destructor Documentation

◆ DPosition() [1/5]

DPosition ( )
inline

◆ ~DPosition()

~DPosition ( )
inline

Destructor (not-virtual as this will save a lot of space!)

◆ DPosition() [2/5]

DPosition ( CoordinateType  x)
inline

Constructor that fills all dimensions with the value x.

References DPosition< D, TCoordinateType >::coordinate_.

◆ DPosition() [3/5]

DPosition ( const DPosition< D, TCoordinateType > &  pos)
inline

Copy constructor.

References DPosition< D, TCoordinateType >::coordinate_.

◆ DPosition() [4/5]

DPosition ( DPosition< D, TCoordinateType > &&  rhs)
inlinenoexcept

Move constructor.

References DPosition< D, TCoordinateType >::coordinate_.

◆ DPosition() [5/5]

DPosition ( CoordinateType  x,
CoordinateType  y 
)
inline

Constructor only for DPosition<2> that takes two Coordinates.

References DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

Member Function Documentation

◆ begin() [1/2]

Iterator begin ( )
inline

Mutable begin iterator.

References DPosition< D, TCoordinateType >::coordinate_.

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ clear()

void clear ( )
inline

◆ end() [1/2]

Iterator end ( )
inline

Mutable end iterator.

References DPosition< D, TCoordinateType >::coordinate_.

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ getX()

CoordinateType getX ( ) const
inline

Name accessor for the first dimension. Only for DPosition<2>, for visualization.

References DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

Referenced by GridBasedClustering< Metric >::cluster().

◆ getY()

CoordinateType getY ( ) const
inline

Name accessor for the second dimension. Only for DPosition<2>, for visualization.

References DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

Referenced by GridBasedClustering< Metric >::cluster().

◆ maxPositive()

static const DPosition maxPositive ( )
inlinestatic

largest positive

References DPosition< D, TCoordinateType >::DPosition().

◆ minNegative()

static const DPosition minNegative ( )
inlinestatic

smallest negative

References DPosition< D, TCoordinateType >::DPosition().

◆ minPositive()

static const DPosition minPositive ( )
inlinestatic

smallest positive

References DPosition< D, TCoordinateType >::DPosition().

◆ operator!=()

bool operator!= ( const DPosition< D, TCoordinateType > &  point) const
inline

Equality operator.

References DPosition< D, TCoordinateType >::operator==().

◆ operator*()

CoordinateType operator* ( const DPosition< D, TCoordinateType > &  point) const
inline

◆ operator*=()

DPosition& operator*= ( CoordinateType  scalar)
inline

Scalar multiplication.

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator+()

DPosition operator+ ( const DPosition< D, TCoordinateType > &  point) const
inline

Addition (a bit inefficient)

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator+=()

DPosition& operator+= ( const DPosition< D, TCoordinateType > &  point)
inline

◆ operator-() [1/2]

DPosition operator- ( ) const
inline

Negation (a bit inefficient)

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator-() [2/2]

DPosition operator- ( const DPosition< D, TCoordinateType > &  point) const
inline

Subtraction (a bit inefficient)

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator-=()

DPosition& operator-= ( const DPosition< D, TCoordinateType > &  point)
inline

◆ operator/=()

DPosition& operator/= ( CoordinateType  scalar)
inline

Scalar division.

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator<()

bool operator< ( const DPosition< D, TCoordinateType > &  point) const
inline

Lexicographical less than operator. Lexicographical comparison from dimension 0 to dimension D-1 is done.

References DPosition< D, TCoordinateType >::coordinate_.

Referenced by DPosition< D, TCoordinateType >::operator>=().

◆ operator<=()

bool operator<= ( const DPosition< D, TCoordinateType > &  point) const
inline

Lexicographical greater less or equal operator.

References DPosition< D, TCoordinateType >::coordinate_.

Referenced by DPosition< D, TCoordinateType >::operator>().

◆ operator=()

DPosition& operator= ( const DPosition< D, TCoordinateType > &  source)
inline

Assignment operator.

References DPosition< D, TCoordinateType >::coordinate_.

◆ operator==()

bool operator== ( const DPosition< D, TCoordinateType > &  point) const
inline

◆ operator>()

bool operator> ( const DPosition< D, TCoordinateType > &  point) const
inline

Lexicographical greater than operator.

References DPosition< D, TCoordinateType >::operator<=().

◆ operator>=()

bool operator>= ( const DPosition< D, TCoordinateType > &  point) const
inline

Lexicographical greater or equal operator.

References DPosition< D, TCoordinateType >::operator<().

◆ operator[]() [1/2]

CoordinateType& operator[] ( Size  index)
inline

Accessor for the dimensions.

References DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

◆ operator[]() [2/2]

CoordinateType operator[] ( Size  index) const
inline

Const accessor for the dimensions.

References DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

◆ setX()

void setX ( CoordinateType  c)
inline

Name mutator for the first dimension. Only for DPosition<2>, for visualization.

References OpenMS::Constants::c, DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

◆ setY()

void setY ( CoordinateType  c)
inline

Name mutator for the second dimension. Only for DPosition<2>, for visualization.

References OpenMS::Constants::c, DPosition< D, TCoordinateType >::coordinate_, and OPENMS_PRECONDITION.

◆ size()

static Size size ( )
inlinestatic

Returns the number of dimensions.

◆ spatiallyGreaterEqual()

bool spatiallyGreaterEqual ( const DPosition< D, TCoordinateType > &  point) const
inline

Spatially (geometrically) greater or equal operator. All coordinates must be ">=".

References DPosition< D, TCoordinateType >::coordinate_.

◆ spatiallyLessEqual()

bool spatiallyLessEqual ( const DPosition< D, TCoordinateType > &  point) const
inline

Spatially (geometrically) less or equal operator. All coordinates must be "<=".

References DPosition< D, TCoordinateType >::coordinate_.

◆ zero()

static const DPosition zero ( )
inlinestatic

Member Data Documentation

◆ coordinate_

CoordinateType coordinate_[D]
protected