Atoms Crowd
7.0.0
|
#include <ImathBox.h>
Public Member Functions | |
Constructors | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 | Box () noexcept |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 | Box (const V &point) noexcept |
Construct a bounding box that contains a single point. | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 | Box (const V &minV, const V &maxV) noexcept |
Construct a bounding box with the given minimum and maximum values. | |
Comparison | |
constexpr ATOMSMATH_HOSTDEVICE bool | operator== (const Box< V > &src) const noexcept |
Equality. | |
constexpr ATOMSMATH_HOSTDEVICE bool | operator!= (const Box< V > &src) const noexcept |
Inequality. | |
Manipulation | |
ATOMSMATH_HOSTDEVICE void | makeEmpty () noexcept |
ATOMSMATH_HOSTDEVICE void | extendBy (const V &point) noexcept |
Extend the box to include the given point. | |
ATOMSMATH_HOSTDEVICE void | extendBy (const Box< V > &box) noexcept |
Extend the box to include the given box. | |
ATOMSMATH_HOSTDEVICE void | makeInfinite () noexcept |
Make the box include the entire range of V . | |
Query | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 V | size () const noexcept |
constexpr ATOMSMATH_HOSTDEVICE V | center () const noexcept |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool | intersects (const V &point) const noexcept |
Return true if the given point is inside the box, false otherwise. | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool | intersects (const Box< V > &box) const noexcept |
Return true if the given box is inside the box, false otherwise. | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 unsigned int | majorAxis () const noexcept |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool | isEmpty () const noexcept |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool | hasVolume () const noexcept |
Return true if the box is larger than a single point, false otherwise. | |
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool | isInfinite () const noexcept |
Public Attributes | |
Direct access to bounds | |
V | min |
The minimum value of the box. | |
V | max |
The maximum value of the box. | |
The Box<V>
template represents an axis-aligned bounding box defined by minimum and maximum values of type V
. The min
and max
members are public.
The type V
is typically an Imath vector (i.e. V2i
, V3f
, etc) and must implement an index operator[]
that returns a type (typically as scalar) that supports assignment, comparison, and arithmetic operators.
V
must also provide a constructor that takes a float and/or double for use in initializing the box.
V
must also provide a function V::dimensions()
which returns the number of dimensions in the class (since its assumed its a vector) – preferably, this returns a constant expression, typically 2 or 3.
Construct an empty bounding box. This initializes the mimimum to std::numeric_limits<V::baseType>::max()
and the maximum to std::numeric_limits<V::baseType>::lowest()
.
|
inlineconstexprnoexcept |
Return the center of the box. The center is defined as (max+min)/2
. The center of an empty box is undefined.
|
inlinenoexcept |
Return true if the box is empty, false otherwise. An empty box's minimum is greater than its maximum.
|
inlinenoexcept |
Return true if the box contains all points, false otherwise. An infinite box has a mimimum ofV::baseTypeLowest()
and a maximum of V::baseTypeMax()
.
|
inlinenoexcept |
Return the major axis of the box. The major axis is the dimension with the greatest difference between maximum and minimum.
|
inlinenoexcept |
Set the box to be empty. A box is empty if the mimimum is greater than the maximum. makeEmpty() sets the mimimum to V::baseTypeMax()
and the maximum to V::baseTypeLowest()
.
|
inlinenoexcept |
Return the size of the box. The size is of type V
, defined as (max-min)
. An empty box has a size of V(0)
, i.e. 0 in each dimension.