10 #ifndef INCLUDED_ATOMSMATHINTERVAL_H
11 #define INCLUDED_ATOMSMATHINTERVAL_H
13 #include <AtomsMath/ImathNamespace.h>
14 #include <AtomsMath/ImathVec.h>
16 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_ENTER
42 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Interval() noexcept;
45 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Interval (const T& point) noexcept;
48 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Interval (const T& minT, const T& maxT) noexcept;
56 ATOMSMATH_HOSTDEVICE constexpr
bool operator== (const
Interval<T>& src) const noexcept;
58 ATOMSMATH_HOSTDEVICE constexpr
bool operator!= (const
Interval<T>& src) const noexcept;
67 ATOMSMATH_HOSTDEVICE
void makeEmpty() noexcept;
70 ATOMSMATH_HOSTDEVICE
void extendBy (const T& point) noexcept;
84 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T
size() const noexcept;
88 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T
center() const noexcept;
91 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
bool intersects (const T& point) const noexcept;
94 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
bool intersects (const
Interval<T>& interval) const noexcept;
98 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
bool isEmpty() const noexcept;
102 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
bool hasVolume() const noexcept;
107 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
bool isInfinite() const noexcept;
113 template <class T> std::ostream& operator<< (std::ostream& s, const
Interval<T>& v);
145 constexpr
inline bool
148 return (
min == src.min &&
max == src.max);
152 constexpr
inline bool
155 return (
min != src.min ||
max != src.max);
162 min = std::numeric_limits<T>::max();
163 max = std::numeric_limits<T>::lowest();
170 min = std::numeric_limits<T>::lowest();
171 max = std::numeric_limits<T>::max();
190 if (interval.min <
min)
193 if (interval.max >
max)
198 ATOMSMATH_CONSTEXPR14
inline bool
201 return point >=
min && point <=
max;
205 ATOMSMATH_CONSTEXPR14
inline bool
208 return interval.max >=
min && interval.min <=
max;
212 ATOMSMATH_CONSTEXPR14
inline T
222 ATOMSMATH_CONSTEXPR14
inline T
229 ATOMSMATH_CONSTEXPR14
inline bool
236 ATOMSMATH_CONSTEXPR14
inline bool
243 ATOMSMATH_CONSTEXPR14
inline bool
246 if (
min != std::numeric_limits<T>::lowest() ||
max != std::numeric_limits<T>::max())
257 return s <<
'(' << v.
min <<
' ' << v.
max <<
')';
260 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImathInterval.h:24
ATOMSMATH_HOSTDEVICE void extendBy(const T &point) noexcept
Extend the interval to include the given point.
Definition: ImathInterval.h:177
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool hasVolume() const noexcept
Definition: ImathInterval.h:237
T max
The minimum value of the interval.
Definition: ImathInterval.h:34
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T size() const noexcept
Return the size of the interval. The size is (max-min). An empty box has a size of 0.
Definition: ImathInterval.h:213
T min
The minimum value of the interval.
Definition: ImathInterval.h:31
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool isInfinite() const noexcept
Definition: ImathInterval.h:244
ATOMSMATH_HOSTDEVICE void makeEmpty() noexcept
Definition: ImathInterval.h:160
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool intersects(const T &point) const noexcept
Return true if the given point is inside the interval, false otherwise.
Definition: ImathInterval.h:199
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Interval() noexcept
Initialize to the empty interval.
Definition: ImathInterval.h:127
constexpr ATOMSMATH_HOSTDEVICE bool operator!=(const Interval< T > &src) const noexcept
Inequality.
Definition: ImathInterval.h:153
constexpr ATOMSMATH_HOSTDEVICE bool operator==(const Interval< T > &src) const noexcept
Equality.
Definition: ImathInterval.h:146
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool isEmpty() const noexcept
Definition: ImathInterval.h:230
ATOMSMATH_HOSTDEVICE void makeInfinite() noexcept
Make the interval include the entire range of the base type.
Definition: ImathInterval.h:168
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T center() const noexcept
Definition: ImathInterval.h:223