53 template <UInt D,
typename TCoordinateType =
double>
100 static_assert(D == 2,
"DPosition<D, TCoordinateType>:DPosition(x,y): index overflow!");
108 static_assert(D == 3,
"DPosition<D, TCoordinateType>:DPosition(x,y,z): index overflow!");
134 for (
Size i = 0; i < D; ++i)
143 for (
Size i = 0; i < D; ++i)
156 OPENMS_PRECONDITION(index < D,
"DPosition<D,TCoordinateType>:operator [] (Position): index overflow!");
163 OPENMS_PRECONDITION(index < D,
"DPosition<D,TCoordinateType>:operator [] (Position): index overflow!");
198 for (
Size i = 0; i < D; i++)
200 #pragma clang diagnostic push
201 #pragma clang diagnostic ignored "-Wfloat-equal"
204 #pragma clang diagnostic pop
221 for (
Size i = 0; i < D; i++)
233 for (
Size i = 0; i < D; i++)
245 for (
Size i = 0; i < D; i++)
255 for (
Size i = 0; i < D; i++)
278 for (
Size i = 0; i < D; ++i)
288 for (
Size i = 0; i < D; ++i)
299 for (
Size i = 0; i < D; ++i)
309 for (
Size i = 0; i < D; ++i)
320 for (
Size i = 0; i < D; ++i)
331 for (
Size i = 0; i < D; ++i)
341 for (
Size i = 0; i < D; ++i)
351 for (
Size i = 0; i < D; ++i)
367 for (
Size i = 0; i < D; ++i)
386 return DPosition((std::numeric_limits<typename DPosition::CoordinateType>::min)());
392 return DPosition(std::numeric_limits<typename DPosition::CoordinateType>::lowest());
398 return DPosition((std::numeric_limits<typename DPosition::CoordinateType>::max)());
436 template <UInt D,
typename TCoordinateType>
439 for (
Size i = 0; i < D; ++i)
441 position[i] *= scalar;
447 template <UInt D,
typename TCoordinateType>
450 for (
Size i = 0; i < D; ++i)
452 position[i] *= scalar;
458 template <UInt D,
typename TCoordinateType>
461 for (
Size i = 0; i < D; ++i)
463 position[i] /= scalar;
469 template <UInt D,
typename TCoordinateType>
473 for (
UInt i = 1; i < D; ++i)
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:55
@ DIMENSION
Definition: DPosition.h:67
CoordinateType & operator[](Size index)
Accessor for the dimensions.
Definition: DPosition.h:161
static constexpr DPosition minPositive()
smallest positive
Definition: DPosition.h:384
CoordinateType value_type
Definition: DPosition.h:73
bool operator==(const DPosition &point) const
Equality operator.
Definition: DPosition.h:196
Iterator begin()
Mutable begin iterator.
Definition: DPosition.h:418
DPosition operator+(const DPosition &point) const
Addition (a bit inefficient)
Definition: DPosition.h:275
const CoordinateType * ConstIterator
Non-mutable iterator.
Definition: DPosition.h:63
bool operator<=(const DPosition &point) const
Lexicographical greater less or equal operator.
Definition: DPosition.h:231
DPosition(DPosition &&rhs) noexcept=default
Move constructor.
DPosition & operator=(DPosition &&source) noexcept=default
Move Assignment operator.
DPosition(CoordinateType x)
Constructor that fills all dimensions with the value x.
Definition: DPosition.h:92
DPosition & operator*=(CoordinateType scalar)
Scalar multiplication.
Definition: DPosition.h:339
DPosition(CoordinateType x, CoordinateType y)
Constructor only for DPosition<2> that takes two Coordinates.
Definition: DPosition.h:98
CoordinateType & reference
Definition: DPosition.h:74
CoordinateType operator[](Size index) const
Const accessor for the dimensions.
Definition: DPosition.h:154
bool spatiallyLessEqual(const DPosition &point) const
Spatially (geometrically) less or equal operator. All coordinates must be "<=".
Definition: DPosition.h:243
DPosition(CoordinateType x, CoordinateType y, CoordinateType z)
Constructor only for DPosition<3> that takes three Coordinates.
Definition: DPosition.h:106
DPosition()=default
Default constructor.
ConstIterator end() const
Non-mutable end iterator.
Definition: DPosition.h:412
DPosition(const DPosition &pos)=default
Copy constructor.
CoordinateType * iterator
Definition: DPosition.h:76
void setX(CoordinateType c)
Name mutator for the first dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:182
bool operator<(const DPosition &point) const
Lexicographical less than operator. Lexicographical comparison from dimension 0 to dimension D-1 is d...
Definition: DPosition.h:219
CoordinateType getY() const
Name accessor for the second dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:175
bool operator>=(const DPosition &point) const
Lexicographical greater or equal operator.
Definition: DPosition.h:269
static constexpr DPosition maxPositive()
largest positive
Definition: DPosition.h:396
bool operator!=(const DPosition &point) const
Equality operator.
Definition: DPosition.h:210
bool operator>(const DPosition &point) const
Lexicographical greater than operator.
Definition: DPosition.h:263
DPosition operator-(const DPosition &point) const
Subtraction (a bit inefficient)
Definition: DPosition.h:296
CoordinateType getX() const
Name accessor for the first dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:168
static constexpr DPosition zero()
all zero
Definition: DPosition.h:378
DPosition & abs() noexcept
Make all dimension values positive.
Definition: DPosition.h:141
const CoordinateType * const_iterator
Definition: DPosition.h:77
Iterator end()
Mutable end iterator.
Definition: DPosition.h:424
CoordinateType operator*(const DPosition &point) const
Inner product.
Definition: DPosition.h:328
static Size size()
Returns the number of dimensions.
Definition: DPosition.h:359
TCoordinateType CoordinateType
Coordinate type.
Definition: DPosition.h:59
DPosition & operator-=(const DPosition &point)
Subtraction.
Definition: DPosition.h:307
static constexpr DPosition minNegative()
smallest negative
Definition: DPosition.h:390
CoordinateType coordinate_[D]
Definition: DPosition.h:432
void clear()
Set all dimensions to zero.
Definition: DPosition.h:365
void swap(DPosition &rhs) noexcept
Swap the two objects.
Definition: DPosition.h:132
~DPosition() noexcept=default
Destructor (not-virtual as this will save a lot of space!)
ConstIterator begin() const
Non-mutable begin iterator.
Definition: DPosition.h:406
bool spatiallyGreaterEqual(const DPosition &point) const
Spatially (geometrically) greater or equal operator. All coordinates must be ">=".
Definition: DPosition.h:253
CoordinateType * pointer
Definition: DPosition.h:75
CoordinateType * Iterator
Mutable iterator.
Definition: DPosition.h:61
DPosition & operator+=(const DPosition &point)
Addition.
Definition: DPosition.h:286
DPosition & operator=(const DPosition &source)=default
Assignment operator.
DPosition & operator/=(CoordinateType scalar)
Scalar division.
Definition: DPosition.h:349
void setY(CoordinateType c)
Name mutator for the second dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:189
DPosition operator-() const
Negation (a bit inefficient)
Definition: DPosition.h:317
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:120
const double c
Definition: Constants.h:214
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
DPosition< D, TCoordinateType > operator*(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:437
DPosition< D, TCoordinateType > operator/(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:459
const PrecisionWrapper< FloatingPointType > precisionWrapper(const FloatingPointType rhs)
Wrapper function that sets the appropriate precision for output temporarily. The original precision i...
Definition: PrecisionWrapper.h:95