103 static_assert(D == 2);
154 for (
UInt i = 0; i != D; i++)
156 if (position[i] <
min_[i])
return false;
158 if (position[i] >=
max_[i])
return false;
166 if (x <
min_[0])
return false;
168 if (x >=
max_[0])
return false;
170 if (y <
min_[1])
return false;
172 if (y >=
max_[1])
return false;
187 for (
Size i = 0; i != D; ++i)
189 united_min[i] =
min_[i] < other_min[i] ?
min_[i] : other_min[i];
190 united_max[i] =
max_[i] > other_max[i] ?
max_[i] : other_max[i];
192 united_range.
setMinMax(united_min, united_max);
208 for (
Size i = 0; i != D; i++)
219 for (
Size i = 0; i != D; i++)
228 for (
Size i = 0; i != D; i++)
254 for (
Size i = 0; i != D; i++)
263 for (
Size i = 0; i != D; i++)
292 for (
UInt i = 0; i != D; ++i)
318 for (
UInt i = 0; i != D; ++i)
329 for (
UInt i = 0; i != D; ++i)
332 if (
max_[i] -
min_[i] < min_span[i])
334 extend_by[i] = min_span[i] - (
max_[i] -
min_[i]);
356 for (
UInt i = 0; i != D; ++i)
358 point[i] = std::max(
min_[i], std::min(point[i],
max_[i]));
369 os <<
"--DRANGE BEGIN--\n";
370 os <<
"MIN --> " << area.
min_ <<
'\n';
371 os <<
"MAX --> " << area.
max_ <<
'\n';
372 os <<
"--DRANGE END--\n";
381 template<OpenMS::UInt D>
386 std::size_t seed = 0;
Representation of a coordinate in D-dimensional space.
Definition DPosition.h:32
A D-dimensional half-open interval.
Definition DRange.h:39
PositionType min_
lower left point
Definition DIntervalBase.h:336
bool encloses(const PositionType &position) const
Checks whether this range (half open interval!) contains a certain point.
Definition DRange.h:152
DRange< D > & extend(double factor)
Extends the range in all dimensions by a certain multiplier.
Definition DRange.h:285
Base::PositionType PositionType
Position type.
Definition DRange.h:51
PositionType max_
upper right point
Definition DIntervalBase.h:339
DRangeIntersection
Types that describe the kind of intersection between two ranges.
Definition DRange.h:56
@ Disjoint
No intersection.
Definition DRange.h:57
@ Inside
One contains the other.
Definition DRange.h:59
@ Intersects
Intersection.
Definition DRange.h:58
DRange united(const DRange< D > &other_range) const
Returns the smallest range containing this range and other_range.
Definition DRange.h:178
bool encloses(CoordinateType x, CoordinateType y) const
2D-version of encloses for convenience only
Definition DRange.h:164
DRange()
Default constructor.
Definition DRange.h:74
DRange & operator=(const DRange &rhs)
Assignment operator.
Definition DRange.h:112
bool operator==(const Base &rhs) const
Equality operator.
Definition DRange.h:141
DRange(const PositionType &lower, const PositionType &upper)
Constructor that takes two Points and constructs a range.
Definition DRange.h:80
DRange(DRange &&) noexcept=default
Move constructor.
~DRange()
Destructor.
Definition DRange.h:126
DRangeIntersection intersects(const DRange &range) const
Checks how this range intersects with another range.
Definition DRange.h:202
DRange(const DRange &range)
Copy constructor.
Definition DRange.h:86
DRange & operator=(const Base &rhs)
Assignment operator for the base class.
Definition DRange.h:119
Internal::DIntervalBase< D > Base
Base class type.
Definition DRange.h:49
Base::CoordinateType CoordinateType
Coordinate type of the positions.
Definition DRange.h:53
DRange< D > & swapDimensions()
swaps dimensions for 2D data (i.e. x and y coordinates)
Definition DRange.h:342
DRange(CoordinateType minx, CoordinateType miny, CoordinateType maxx, CoordinateType maxy)
Convenient constructor for DRange<2>
Definition DRange.h:101
void pullIn(DPosition< D > &point) const
Make sure point is inside the current area.
Definition DRange.h:354
DRange< D > & extend(typename Base::PositionType addition)
Extends the range in all dimensions by a certain amount.
Definition DRange.h:313
@ DIMENSION
Definition DRange.h:47
bool operator==(const DRange &rhs) const
Equality operator.
Definition DRange.h:135
DRange< D > & ensureMinSpan(typename Base::PositionType min_span)
Definition DRange.h:326
bool isIntersected(const DRange &range) const
Checks whether this range intersects with another range.
Definition DRange.h:244
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition Exception.h:317
A base class for D-dimensional interval.
Definition DIntervalBase.h:30
PositionType min_
lower left point
Definition DIntervalBase.h:336
PositionType const & maxPosition() const
Accessor to maximum position.
Definition DIntervalBase.h:104
PositionType::CoordinateType CoordinateType
Coordinate type of the positions.
Definition DIntervalBase.h:42
PositionType max_
upper right point
Definition DIntervalBase.h:339
PositionType const & minPosition() const
Accessor to minimum position.
Definition DIntervalBase.h:98
bool operator==(const DIntervalBase &rhs) const
Equality operator.
Definition DIntervalBase.h:169
DPosition< D > PositionType
Position type.
Definition DIntervalBase.h:40
void setMinMax(PositionType const &min, PositionType const &max)
Mutator for minimum and maximum position.
Definition DIntervalBase.h:142
DIntervalBase & operator=(const DIntervalBase &rhs)
Assignment operator.
Definition DIntervalBase.h:70
void normalize_()
normalization to keep all dimensions in the right geometrical order (min_[X] < max_[X])
Definition DIntervalBase.h:342
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
void hash_combine(std::size_t &seed, std::size_t value) noexcept
Combine a hash value with additional data using golden ratio mixing.
Definition HashUtils.h:87
std::size_t hash_float(T value) noexcept
Hash for a floating point type (float or double).
Definition HashUtils.h:142
std::size_t operator()(const OpenMS::DRange< D > &range) const noexcept
Definition DRange.h:384