Interval¶
The Interval class template represents a scalar interval, with
predefined typedefs for short, int, float, and double.
An Interval is essentially a Box<T> that allows T to be a
scalar.
Example:
#include <Imath/ImathInterval.h>
void
interval_example()
{
Imath::Intervalf v;
assert (v.isEmpty());
assert (!v.hasVolume());
assert (!v.isInfinite());
v.extendBy (1.0f);
assert (!v.isEmpty());
v.extendBy (2.0f);
assert (v.hasVolume());
assert (v.intersects (1.5f));
}
-
template <class T>
classInterval¶ An Interval has a min and a max and some miscellaneous functions.
It is basically a Box<T> that allows T to be a scalar.
Direct access to bounds
-
T
min¶ The minimum value of the interval.
-
T
max¶ The minimum value of the interval.
Constructors
-
constexpr
Interval()¶ Initialize to the empty interval.
-
constexpr
Interval(const T &point)¶ Intitialize to a single point.
-
constexpr
Interval(const T &minT, const T &maxT)¶ Intitialize to a given (min,max)
Comparison
Manipulation
-
void
makeEmpty()¶ Set the interval to be empty.
An interval is empty if the minimum is greater than the maximum.
-
void
extendBy(const T &point)¶ Extend the interval to include the given point.
-
void
makeInfinite()¶ Make the interval include the entire range of the base type.
Query
-
constexpr T
size() const¶ Return the size of the interval. The size is (max-min). An empty box has a size of 0.
-
constexpr T
center() const¶ Return the center of the interval.
The center is defined as (max+min)/2. The center of an empty interval is undefined.
-
constexpr bool
intersects(const T &point) const¶ Return true if the given point is inside the interval, false otherwise.
-
constexpr bool
intersects(const Interval<T> &interval) const¶ Return true if the given interval is inside the interval, false otherwise.
-
constexpr bool
isEmpty() const¶ Return true if the interval is empty, false otherwise.
An empty interval’s minimum is greater than its maximum.
-
constexpr bool
hasVolume() const¶ Return true if the interval is larger than a single point, false otherwise.
-
constexpr bool
isInfinite() const¶ Return true if the interval contains all points, false otherwise.
An infinite box has a mimimum of
numeric_limits<T>::lowest()and a maximum ofnumeric_limits<T>::max()
-
T
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream& s, const Interval<T>& v) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- std::ostream &operator<<(std::ostream&, Imath::half)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Color4<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Euler<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Interval<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Line3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix22<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix33<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix44<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Plane3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Quat<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Shear6<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec2<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec3<T>&)
- template <class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec4<T>&)