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

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 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 (CoordinateType x, CoordinateType y)
 Constructor only for DPosition<2> that takes two Coordinates. More...
 
DPositionoperator= (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...
 
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/4]

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/4]

DPosition ( CoordinateType  x)
inline

Constructor that fills all dimensions with the value x.

◆ DPosition() [3/4]

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

Copy constructor.

◆ DPosition() [4/4]

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

◆ begin() [2/2]

Iterator begin ( )
inline

Mutable begin iterator.

◆ clear()

void clear ( )
inline

◆ end() [1/2]

ConstIterator end ( ) const
inline

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

largest positive

◆ minNegative()

static const DPosition minNegative ( )
inlinestatic

smallest negative

◆ minPositive()

static const DPosition minPositive ( )
inlinestatic

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

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

all zero

Member Data Documentation

◆ coordinate_

CoordinateType coordinate_[D]
protected