23 #ifndef LSST_SPHGEOM_INTERVAL_H_ 24 #define LSST_SPHGEOM_INTERVAL_H_ 47 template <
typename Derived,
typename Scalar>
69 return (_a == x && _b == x) || (x != x &&
isEmpty());
99 return (_a <= x && x <= _b) || x !=
x;
108 return _a <= x._a && _b >= x._b;
123 return _a > x._b || _b < x._a;
141 return (_a == x && _b == x) ||
isEmpty();
248 template <
typename Derived,
typename Scalar>
252 return CONTAINS | DISJOINT | WITHIN;
254 return DISJOINT | WITHIN;
257 return CONTAINS | DISJOINT;
259 if (_a == x && _b == x) {
260 return CONTAINS | WITHIN;
268 template <
typename Derived,
typename Scalar>
274 return CONTAINS | DISJOINT | WITHIN;
276 return DISJOINT | WITHIN;
279 return CONTAINS | DISJOINT;
281 if (_a == x._a && _b == x._b) {
282 return CONTAINS | WITHIN;
284 if (_a > x._b || _b < x._a) {
287 if (_a <= x._a && _b >= x._b) {
290 if (x._a <= _a && x._b >= _b) {
298 #endif // LSST_SPHGEOM_INTERVAL_H_ Derived clippedTo(Scalar x) const
Scalar getA() const
getA returns the lower endpoint of this interval.
Interval & erodeBy(Scalar x)
bool isWithin(Interval const &x) const
Interval & clipTo(Scalar x)
bool isDisjointFrom(Interval const &x) const
double Scalar
Typedefs to be used for probability and parameter values.
bool isWithin(Scalar x) const
Interval()
This constructor creates an empty interval.
bool contains(Interval const &x) const
Scalar getCenter() const
getCenter returns the center of this interval.
Derived erodedBy(Scalar x) const
Scalar getSize() const
getSize returns the size (length, width) of this interval.
Interval & clipTo(Interval const &x)
Relationship relate(Scalar x) const
A base class for image defects.
bool intersects(Interval const &x) const
Interval & expandTo(Scalar x)
Interval(Scalar x, Scalar y)
This constructor creates an interval from the given endpoints.
Derived expandedTo(Scalar x) const
Interval(Scalar x)
This constructor creates a closed interval containing only x.
bool isEmpty() const
isEmpty returns true if this interval does not contain any points.
Derived dilatedBy(Scalar x) const
bool operator!=(Scalar x) const
bool operator==(Scalar x) const
A closed interval is equal to a point x if both endpoints equal x.
Scalar getB() const
getB returns the upper endpoint of this interval.
This file provides a type alias for describing set relationships.
Derived clippedTo(Interval const &x) const
bool isDisjointFrom(Scalar x) const
bool contains(Scalar x) const
Interval represents a closed interval of the real numbers by its upper and lower bounds.
Interval & dilateBy(Scalar x)
For positive x, dilateBy morphologically dilates this interval by [-x,x], which is equivalent to the ...
bool operator!=(Interval const &i) const
Interval & expandTo(Interval const &x)
Derived expandedTo(Interval const &x) const
bool intersects(Scalar x) const
bool operator==(Interval const &i) const
Two closed intervals are equal if their endpoints are the same, or both are empty.