35 #ifndef OPENMS_DATASTRUCTURES_DRANGE_H
36 #define OPENMS_DATASTRUCTURES_DRANGE_H
172 for (
UInt i = 0; i != D; i++)
174 if (position[i] <
min_[i])
return false;
176 if (position[i] >=
max_[i])
return false;
184 if (x <
min_[0])
return false;
186 if (x >=
max_[0])
return false;
188 if (y <
min_[1])
return false;
190 if (y >=
max_[1])
return false;
205 for (
Size i = 0; i != D; ++i)
207 united_min[i] =
min_[i] < other_min[i] ?
min_[i] : other_min[i];
208 united_max[i] =
max_[i] > other_max[i] ?
max_[i] : other_max[i];
210 united_range.
setMinMax(united_min, united_max);
226 for (
Size i = 0; i != D; i++)
237 for (
Size i = 0; i != D; i++)
246 for (
Size i = 0; i != D; i++)
272 for (
Size i = 0; i != D; i++)
281 for (
Size i = 0; i != D; i++)
294 for (
UInt i = 0; i != D; i++)
309 std::ostream & operator<<(std::ostream & os, const DRange<D> & area)
311 os <<
"--DRANGE BEGIN--" << std::endl;
312 os <<
"MIN --> " << area.min_ << std::endl;
313 os <<
"MAX --> " << area.max_ << std::endl;
314 os <<
"--DRANGE END--" << std::endl;
320 #endif // OPENMS_DATASTRUCTURES_DRANGE_H
bool operator==(const DRange &rhs) const
Equality operator.
Definition: DRange.h:153
Base::PositionType PositionType
Position type.
Definition: DRange.h:73
No intersection.
Definition: DRange.h:79
DRange(CoordinateType minx, CoordinateType miny, CoordinateType maxx, CoordinateType maxy)
Convenient constructor for DRange<2>
Definition: DRange.h:120
PositionType min_
lower left point
Definition: DIntervalBase.h:308
bool encloses(const PositionType &position) const
Checks whether this range contains a certain point.
Definition: DRange.h:170
bool operator==(const Base &rhs) const
Equality operator.
Definition: DRange.h:159
Internal::DIntervalBase< D > Base
Base class type.
Definition: DRange.h:71
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: Macros.h:107
DIntervalBase & operator=(const DIntervalBase &rhs)
Assignment operator.
Definition: DIntervalBase.h:93
bool operator==(const DIntervalBase &rhs) const
Equality operator.
Definition: DIntervalBase.h:192
DRange united(const DRange< D > &other_range) const
Returns the smallest range containing this range and other_range.
Definition: DRange.h:196
DRange()
Default constructor.
Definition: DRange.h:96
bool encloses(CoordinateType x, CoordinateType y) const
2D-version of encloses for convenience only
Definition: DRange.h:182
DRange & operator=(const DRange &rhs)
Assignement operator.
Definition: DRange.h:130
DRange(const DRange &range)
Copy constructor.
Definition: DRange.h:108
bool isIntersected(const DRange &range) const
Checks whether this range intersects with another range.
Definition: DRange.h:262
Base::CoordinateType CoordinateType
Coordinate type of the positions.
Definition: DRange.h:75
DRange(const Base &range)
Copy constructor for the base class.
Definition: DRange.h:114
DRange & operator=(const Base &rhs)
Assignement operator for the base class.
Definition: DRange.h:137
bool isEmpty() const
Checks if the range is empty.
Definition: DRange.h:292
A D-dimensional half-open interval.
Definition: DRange.h:59
PositionType max_
upper right point
Definition: DIntervalBase.h:311
~DRange()
Destuctor.
Definition: DRange.h:144
PositionType const & minPosition() const
Accessor to minimum position.
Definition: DIntervalBase.h:121
A base class for D-dimensional interval.
Definition: DIntervalBase.h:55
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
DRangeIntersection
Types that describe the kind of intersection between two ranges.
Definition: DRange.h:77
void setMinMax(PositionType const &min, PositionType const &max)
Mutator for minimum and maximum position.
Definition: DIntervalBase.h:165
PositionType const & maxPosition() const
Accessor to maximum position.
Definition: DIntervalBase.h:127
Intersection.
Definition: DRange.h:80
DRangeIntersection intersects(const DRange &range) const
Checks how this range intersects with another range.
Definition: DRange.h:220
DRange(const PositionType &lower, const PositionType &upper)
Constructor that takes two Points and constructs a range.
Definition: DRange.h:102
One contains the other.
Definition: DRange.h:81