| OpenMS 2.5.0

Public Types | Protected Attributes | List of all members
DPosition< D, TCoordinateType > Class Template Reference
Datastructures

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

`#include <OpenMS/DATASTRUCTURES/DPosition.h>`

## Public Types

enum | { DIMENSION = D }
| Dimensions. More...
typedef TCoordinateType | CoordinateType
| Coordinate type. More...
typedef CoordinateType * | Iterator
| Mutable iterator. More...
typedef const CoordinateType * | ConstIterator
| Non-mutable iterator. More...
STL compatibility type definitions
typedef CoordinateType | value_type
typedef CoordinateType & | reference
typedef CoordinateType * | pointer
typedef CoordinateType * | iterator
typedef const CoordinateType * | const_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...
DPosition & | operator= (const DPosition &source)
| Assignment operator. More...
Iteration
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...

## 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...

## Protected Attributes

CoordinateType | coordinate_ [D]

## Accessors

CoordinateType | operator[] (Size index) const
| Const accessor for the dimensions. More...
CoordinateType & | operator[] (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...
DPosition & | operator+= (const DPosition &point)
| Addition. More...
DPosition | operator- (const DPosition &point) const
| Subtraction (a bit inefficient) More...
DPosition & | operator-= (const DPosition &point)
| Subtraction. More...
DPosition | operator- () const
| Negation (a bit inefficient) More...
CoordinateType | operator* (const DPosition &point) const
| Inner product. More...
DPosition & | operator*= (CoordinateType scalar)
| Scalar multiplication. More...
DPosition & | operator/= (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

typedef const CoordinateType* const_iterator

## ◆ ConstIterator

typedef const CoordinateType* ConstIterator

Non-mutable iterator.

## ◆ CoordinateType

typedef TCoordinateType CoordinateType

Coordinate type.

## ◆ Iterator

typedef CoordinateType* Iterator

Mutable iterator.

## ◆ iterator

typedef CoordinateType* iterator

## ◆ pointer

typedef CoordinateType* pointer

## ◆ reference

typedef CoordinateType& reference

## ◆ value_type

typedef CoordinateType value_type

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum

Dimensions.

Enumerator
DIMENSION |

## Constructor & Destructor Documentation

## ◆ DPosition() [1/5]

DPosition | ( |  | ) |

inline

Default constructor.

Creates a position with all coordinates zero.

Referenced by DPosition< DIMENSION >::maxPositive(), DPosition< DIMENSION >::minNegative(), and DPosition< DIMENSION >::minPositive().

## ◆ ~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`.

## ◆ DPosition() [3/5]

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

inline

Copy constructor.

## ◆ DPosition() [4/5]

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

inline noexcept

Move constructor.

## ◆ DPosition() [5/5]

DPosition | ( | CoordinateType | x,
|  | CoordinateType | y
| ) |  |

inline

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

## Member Function Documentation

## ◆ begin() [1/2]

ConstIterator begin | ( |  | ) | const

inline

Non-mutable begin iterator.

Referenced by HashGrid< Cluster >::cellindexAtClustercenter_(), OpenMS::hash_value(), and HashGrid< Cluster >::updateGridDimension_().

## ◆ begin() [2/2]

Iterator begin | ( |  | ) |

inline

Mutable begin iterator.

## ◆ clear()

void clear | ( |  | ) |

inline

Set all dimensions to zero.

Referenced by AveragePosition< D >::add(), AveragePosition< D >::clear(), and DPosition< DIMENSION >::DPosition().

## ◆ end() [1/2]

ConstIterator end | ( |  | ) | const

inline

Non-mutable end iterator.

Referenced by HashGrid< Cluster >::cellindexAtClustercenter_(), OpenMS::hash_value(), and HashGrid< Cluster >::updateGridDimension_().

## ◆ end() [2/2]

Iterator end | ( |  | ) |

inline

Mutable end iterator.

## ◆ getX()

CoordinateType getX | ( |  | ) | const

inline

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

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

## ◆ getY()

CoordinateType getY | ( |  | ) | const

inline

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

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

## ◆ maxPositive()

static const DPosition maxPositive | ( |  | ) |

inline static

largest positive

## ◆ minNegative()

static const DPosition minNegative | ( |  | ) |

inline static

smallest negative

## ◆ minPositive()

static const DPosition minPositive | ( |  | ) |

inline static

smallest positive

## ◆ operator!=()

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

inline

Equality operator.

## ◆ operator*()

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

inline

Inner product.

## ◆ operator*=()

DPosition& operator*= | ( | CoordinateType | scalar | ) |

inline

Scalar multiplication.

## ◆ operator+()

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

inline

Addition (a bit inefficient)

## ◆ operator+=()

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

inline

Addition.

## ◆ operator-() [1/2]

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

inline

Subtraction (a bit inefficient)

## ◆ operator-() [2/2]

DPosition operator- | ( |  | ) | const

inline

Negation (a bit inefficient)

## ◆ operator-=()

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

inline

Subtraction.

## ◆ operator/=()

DPosition& operator/= | ( | CoordinateType | scalar | ) |

inline

Scalar division.

## ◆ 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.

Referenced by DPosition< DIMENSION >::operator>=().

## ◆ operator<=()

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

inline

Lexicographical greater less or equal operator.

Referenced by DPosition< DIMENSION >::operator>().

## ◆ operator=()

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

inline

Assignment operator.

## ◆ operator==()

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

inline

Equality operator.

Referenced by DPosition< DIMENSION >::operator!=().

## ◆ operator>()

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

inline

Lexicographical greater than operator.

## ◆ operator>=()

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

inline

Lexicographical greater or equal operator.

## ◆ operator[]() [1/2]

CoordinateType operator[] | ( | Size | index | ) | const

inline

Const accessor for the dimensions.

## ◆ operator[]() [2/2]

CoordinateType& operator[] | ( | Size | index | ) |

inline

Accessor for the dimensions.

## ◆ setX()

void setX | ( | CoordinateType | c | ) |

inline

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

## ◆ setY()

void setY | ( | CoordinateType | c | ) |

inline

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

## ◆ size()

static Size size | ( |  | ) |

inline static

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 ">=".

## ◆ spatiallyLessEqual()

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

inline

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

## ◆ zero()

static const DPosition zero | ( |  | ) |

inline static

all zero

## Member Data Documentation

## ◆ coordinate_

CoordinateType coordinate_[D]

protected

Referenced by DPosition< DIMENSION >::begin(), DPosition< DIMENSION >::clear(), DPosition< DIMENSION >::DPosition(), DPosition< DIMENSION >::end(), DPosition< DIMENSION >::getX(), DPosition< DIMENSION >::getY(), DPosition< DIMENSION >::operator*(), DPosition< DIMENSION >::operator*=(), DPosition< DIMENSION >::operator+(), DPosition< DIMENSION >::operator+=(), DPosition< DIMENSION >::operator-(), DPosition< DIMENSION >::operator-=(), DPosition< DIMENSION >::operator/=(), DPosition< DIMENSION >::operator<(), DPosition< DIMENSION >::operator<=(), DPosition< DIMENSION >::operator=(), DPosition< DIMENSION >::operator==(), DPosition< DIMENSION >::operator[](), DPosition< DIMENSION >::setX(), DPosition< DIMENSION >::setY(), DPosition< DIMENSION >::spatiallyGreaterEqual(), and DPosition< DIMENSION >::spatiallyLessEqual().