27 template <UInt D,
typename TCoordinateType =
double>
74 static_assert(D == 2,
"DPosition<D, TCoordinateType>:DPosition(x,y): index overflow!");
82 static_assert(D == 3,
"DPosition<D, TCoordinateType>:DPosition(x,y,z): index overflow!");
108 for (
Size i = 0; i < D; ++i)
117 for (
Size i = 0; i < D; ++i)
130 OPENMS_PRECONDITION(index < D,
"DPosition<D,TCoordinateType>:operator [] (Position): index overflow!");
137 OPENMS_PRECONDITION(index < D,
"DPosition<D,TCoordinateType>:operator [] (Position): index overflow!");
172 for (
Size i = 0; i < D; i++)
174 #pragma clang diagnostic push
175 #pragma clang diagnostic ignored "-Wfloat-equal"
178 #pragma clang diagnostic pop
195 for (
Size i = 0; i < D; i++)
207 for (
Size i = 0; i < D; i++)
219 for (
Size i = 0; i < D; i++)
229 for (
Size i = 0; i < D; i++)
252 for (
Size i = 0; i < D; ++i)
262 for (
Size i = 0; i < D; ++i)
273 for (
Size i = 0; i < D; ++i)
283 for (
Size i = 0; i < D; ++i)
294 for (
Size i = 0; i < D; ++i)
305 for (
Size i = 0; i < D; ++i)
315 for (
Size i = 0; i < D; ++i)
325 for (
Size i = 0; i < D; ++i)
341 for (
Size i = 0; i < D; ++i)
360 return DPosition((std::numeric_limits<typename DPosition::CoordinateType>::min)());
366 return DPosition(std::numeric_limits<typename DPosition::CoordinateType>::lowest());
372 return DPosition((std::numeric_limits<typename DPosition::CoordinateType>::max)());
410 template <UInt D,
typename TCoordinateType>
413 for (
Size i = 0; i < D; ++i)
415 position[i] *= scalar;
421 template <UInt D,
typename TCoordinateType>
424 for (
Size i = 0; i < D; ++i)
426 position[i] *= scalar;
432 template <UInt D,
typename TCoordinateType>
435 for (
Size i = 0; i < D; ++i)
437 position[i] /= scalar;
443 template <UInt D,
typename TCoordinateType>
447 for (
UInt i = 1; i < D; ++i)
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:29
@ DIMENSION
Definition: DPosition.h:41
CoordinateType & operator[](Size index)
Accessor for the dimensions.
Definition: DPosition.h:135
static constexpr DPosition minPositive()
smallest positive
Definition: DPosition.h:358
CoordinateType value_type
Definition: DPosition.h:47
bool operator==(const DPosition &point) const
Equality operator.
Definition: DPosition.h:170
Iterator begin()
Mutable begin iterator.
Definition: DPosition.h:392
DPosition operator+(const DPosition &point) const
Addition (a bit inefficient)
Definition: DPosition.h:249
const CoordinateType * ConstIterator
Non-mutable iterator.
Definition: DPosition.h:37
bool operator<=(const DPosition &point) const
Lexicographical greater less or equal operator.
Definition: DPosition.h:205
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:66
DPosition & operator*=(CoordinateType scalar)
Scalar multiplication.
Definition: DPosition.h:313
DPosition(CoordinateType x, CoordinateType y)
Constructor only for DPosition<2> that takes two Coordinates.
Definition: DPosition.h:72
CoordinateType & reference
Definition: DPosition.h:48
CoordinateType operator[](Size index) const
Const accessor for the dimensions.
Definition: DPosition.h:128
bool spatiallyLessEqual(const DPosition &point) const
Spatially (geometrically) less or equal operator. All coordinates must be "<=".
Definition: DPosition.h:217
DPosition(CoordinateType x, CoordinateType y, CoordinateType z)
Constructor only for DPosition<3> that takes three Coordinates.
Definition: DPosition.h:80
DPosition()=default
Default constructor.
ConstIterator end() const
Non-mutable end iterator.
Definition: DPosition.h:386
DPosition(const DPosition &pos)=default
Copy constructor.
CoordinateType * iterator
Definition: DPosition.h:50
void setX(CoordinateType c)
Name mutator for the first dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:156
bool operator<(const DPosition &point) const
Lexicographical less than operator. Lexicographical comparison from dimension 0 to dimension D-1 is d...
Definition: DPosition.h:193
CoordinateType getY() const
Name accessor for the second dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:149
bool operator>=(const DPosition &point) const
Lexicographical greater or equal operator.
Definition: DPosition.h:243
static constexpr DPosition maxPositive()
largest positive
Definition: DPosition.h:370
bool operator!=(const DPosition &point) const
Equality operator.
Definition: DPosition.h:184
bool operator>(const DPosition &point) const
Lexicographical greater than operator.
Definition: DPosition.h:237
DPosition operator-(const DPosition &point) const
Subtraction (a bit inefficient)
Definition: DPosition.h:270
CoordinateType getX() const
Name accessor for the first dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:142
static constexpr DPosition zero()
all zero
Definition: DPosition.h:352
DPosition & abs() noexcept
Make all dimension values positive.
Definition: DPosition.h:115
const CoordinateType * const_iterator
Definition: DPosition.h:51
Iterator end()
Mutable end iterator.
Definition: DPosition.h:398
CoordinateType operator*(const DPosition &point) const
Inner product.
Definition: DPosition.h:302
static Size size()
Returns the number of dimensions.
Definition: DPosition.h:333
TCoordinateType CoordinateType
Coordinate type.
Definition: DPosition.h:33
DPosition & operator-=(const DPosition &point)
Subtraction.
Definition: DPosition.h:281
static constexpr DPosition minNegative()
smallest negative
Definition: DPosition.h:364
CoordinateType coordinate_[D]
Definition: DPosition.h:406
void clear()
Set all dimensions to zero.
Definition: DPosition.h:339
void swap(DPosition &rhs) noexcept
Swap the two objects.
Definition: DPosition.h:106
~DPosition() noexcept=default
Destructor (not-virtual as this will save a lot of space!)
ConstIterator begin() const
Non-mutable begin iterator.
Definition: DPosition.h:380
bool spatiallyGreaterEqual(const DPosition &point) const
Spatially (geometrically) greater or equal operator. All coordinates must be ">=".
Definition: DPosition.h:227
CoordinateType * pointer
Definition: DPosition.h:49
CoordinateType * Iterator
Mutable iterator.
Definition: DPosition.h:35
DPosition & operator+=(const DPosition &point)
Addition.
Definition: DPosition.h:260
DPosition & operator=(const DPosition &source)=default
Assignment operator.
DPosition & operator/=(CoordinateType scalar)
Scalar division.
Definition: DPosition.h:323
void setY(CoordinateType c)
Name mutator for the second dimension. Only for DPosition<2>, for visualization.
Definition: DPosition.h:163
DPosition operator-() const
Negation (a bit inefficient)
Definition: DPosition.h:291
unsigned int UInt
Unsigned integer type.
Definition: Types.h:68
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:94
const double c
Definition: Constants.h:188
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
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:411
DPosition< D, TCoordinateType > operator/(DPosition< D, TCoordinateType > position, typename DPosition< D, TCoordinateType >::CoordinateType scalar)
Scalar multiplication (a bit inefficient)
Definition: DPosition.h:433
const PrecisionWrapper< FloatingPointType > precisionWrapper(const FloatingPointType rhs)
Wrapper function that sets the appropriate precision for output temporarily. The original precision i...
Definition: PrecisionWrapper.h:69