Axis-aligned N-dimensional bounding box class template of fixed dimension. More...
Public Types | |
enum | Uninitialized_tag { UNINITIALIZED_TAG } |
Enum type used to tag a special constructor that does not initialize the elements of the constructed bounding box. More... |
|
typedef math::Vector< T, DIM > | Vector |
Corresponding vector type. More... |
|
typedef Bbox_struct< T, DIM > | Pod_type |
POD class corresponding to this bounding box. More... |
|
typedef Vector | value_type |
Coordinate type. More... |
|
typedef Size | size_type |
Size type, unsigned. More... |
|
typedef Difference | difference_type |
Difference type, signed. More... |
|
typedef Vector * | pointer |
Mutable pointer to vector. More... |
|
typedef const Vector * | const_pointer |
Const pointer to vector. More... |
|
typedef Vector & | reference |
Mutable reference to vector. More... |
|
typedef const Vector & | const_reference |
Const reference to vector. More... |
|
Public Member Functions | |
void | clear () |
Reinitializes this bounding box to the empty space. More... |
|
Bbox () | |
Bounding box initialized to the empty space, see also the clear function. More... |
|
Bbox (Uninitialized_tag) | |
Bounding box with its elements not initialized. More... |
|
Bbox (const Bbox_struct< T, DIM > &bbox_struct) | |
Bounding box initialized from corresponding POD type. More... |
|
Bbox (const Vector &point) | |
Bounding box initialized to a single point . More... |
|
Bbox (const Vector &nmin, const Vector &nmax) | |
Bounding box initialized to the new extreme corner vectors, nmin and nmax . More... |
|
Bbox (T min_x, T max_x) | |
1D bounding box (interval) initialized to the new extreme corner vectors, (min_x) and (max_x). More... |
|
Bbox (T min_x, T min_y, T max_x, T max_y) | |
2D bounding box (interval) initialized to the new extreme corner vectors, (min_x,min_y) and (max_x,max_y). More... |
|
Bbox (T min_x, T min_y, T min_z, T max_x, T max_y, T max_z) | |
3D bounding box (interval) initialized to the new extreme corner vectors, (min_x,min_y,min_z) and (max_x,max_y,max_z). More... |
|
template<typename InputIterator > | |
Bbox (InputIterator first, InputIterator last) | |
Constructs a bounding box from a range [first , last ) of items. More... |
|
template<typename T2 > | |
Bbox (const Bbox< T2, DIM > &other) | |
Template constructor that allows explicit conversions from other bounding boxes with assignment compatible element value type. More... |
|
Bbox & | operator= (const Bbox &other) |
Assignment. More... |
|
Bbox & | operator= (const Bbox_struct< T, DIM > &other) |
Assignment from corresponding POD type. More... |
|
operator Bbox_struct< T, DIM > () const | |
Conversion to corresponding POD type. More... |
|
Vector * | begin () |
Returns the pointer to the first vector, min . More... |
|
const Vector * | begin () const |
Returns the pointer to the first vector, min . More... |
|
Vector * | end () |
Returns the past-the-end pointer. More... |
|
const Vector * | end () const |
Returns the past-the-end pointer. More... |
|
Vector & | operator[] (Size i) |
Returns the vector min for i==0 , and the vector max for i==1 . More... |
|
const Vector & | operator[] (Size i) const |
Returns the vector min for i==0 , and the vector max for i==1 . More... |
|
bool | empty () const |
Returns true if the box is empty. More... |
|
Size | rank () const |
Returns the rank of the bounding box. More... |
|
bool | is_point () const |
Returns true the bounding box is a single point. More... |
|
bool | is_line () const |
Returns true the bounding box is an axis-aligned line. More... |
|
bool | is_plane () const |
Returns true the bounding box is an axis-aligned plane. More... |
|
bool | is_volume () const |
Returns true the bounding box has a volume. More... |
|
bool | contains (const Vector &vec) const |
Returns true if the point is inside or on the boundary of the bounding box. More... |
|
bool | intersects (const Bbox &other) const |
Returns true if this bounding box and the other bounding box intersect in their interiors or on their boundaries. More... |
|
void | insert (const Bbox &other) |
Assigns the union of this bounding box and the other bounding box to this bounding box. More... |
|
void | insert (const Vector &point) |
Assigns the union of this bounding box and the point to this bounding box. More... |
|
template<typename InputIterator > | |
void | insert (InputIterator first, InputIterator last) |
Inserts a range [first ,last ) of items into this bounding box. More... |
|
Bbox | add_motionbox (const Bbox &vbox, T t) const |
Returns the translation of this bounding box by vectors that are inside the scaled bounding box of vectors, i.e., t*vbox . More... |
|
void | push_back (const Bbox &other) |
Assigns the union of this bounding box and the other bounding box to this bounding box. More... |
|
void | robust_grow (T eps=T(1.0e-5f)) |
Robustly grows the bounding box by a value computed automatically from the bounding box dimensions and location in space. More... |
|
T | volume () const |
Returns the volume of the bounding box. More... |
|
T | diagonal_length () const |
Returns the length of the diagonal. More... |
|
Size | largest_extent_index () const |
Returns the index of the dimension in which the bounding box has its largest extent, i.e., 0=x, 1=y, 2=z. More... |
|
Vector | center () const |
Returns the center point of the bounding box. More... |
|
Static Public Member Functions | |
static Size | size () |
Constant size of the bounding box. More... |
|
static Size | max_size () |
Constant maximum size of the bounding box. More... |
|
Public Attributes | |
Vector | min |
Elementwise minimal bounding box corner. More... |
|
Vector | max |
Elementwise maximal bounding box corner. More... |
|
Static Public Attributes | |
static const Size | DIMENSION = DIM |
Constant dimension of the vectors. More... |
|
static const Size | SIZE = 2 |
Constant size of the bounding box. More... |
|
Axis-aligned N-dimensional bounding box class template of fixed dimension.
A bounding box is represented by two mi::math::Vector vectors representing the elementwise minimal box corner, min
, and the elementwise largest box corner, max
.
An instantiation of the bounding box class template is a model of the STL container concept. It provides random access to its two vectors and corresponding random access iterators.
The template parameters have the following requirements:
+ - * / == != < > <= >=
.typedef const Vector* mi::math::Bbox< T, DIM >::const_pointer |
Const pointer to vector.
typedef const Vector& mi::math::Bbox< T, DIM >::const_reference |
Const reference to vector.
typedef Difference mi::math::Bbox< T, DIM >::difference_type |
Difference type, signed.
typedef Bbox_struct<T,DIM> mi::math::Bbox< T, DIM >::Pod_type |
POD class corresponding to this bounding box.
typedef Vector* mi::math::Bbox< T, DIM >::pointer |
Mutable pointer to vector.
typedef Vector& mi::math::Bbox< T, DIM >::reference |
Mutable reference to vector.
typedef Size mi::math::Bbox< T, DIM >::size_type |
Size type, unsigned.
typedef Vector mi::math::Bbox< T, DIM >::value_type |
Coordinate type.
typedef math::Vector<T,DIM> mi::math::Bbox< T, DIM >::Vector |
Corresponding vector type.
enum mi::math::Bbox::Uninitialized_tag |
|
inline |
Bounding box initialized to the empty space, see also the clear function.
The vector min
is set elementwise to mi::base::numeric_traits<T>::max() and the vector max
is set elementwise to mi::base::numeric_traits<T>::negative_max(). This initialization allows to insert points and other bounding boxes; a cleared bounding box will take the value of the first inserted point or bound box.
|
inlineexplicit |
Bounding box with its elements not initialized.
|
inline |
Bounding box initialized from corresponding POD type.
|
inlineexplicit |
Bounding box initialized to a single point
.
point | point. |
|
inline |
Bounding box initialized to the new extreme corner vectors, nmin
and nmax
.
nmin |
min corner vector |
nmax |
max corner vector |
|
inline |
1D bounding box (interval) initialized to the new extreme corner vectors, (min_x) and
(max_x).
DIM == 1
min_x | x-coordinate of min corner vector |
max_x | x coordinate of max corner vector |
|
inline |
2D bounding box (interval) initialized to the new extreme corner vectors, (min_x,min_y) and
(max_x,max_y).
DIM == 2
min_x | x-coordinate of min corner vector |
min_y | y-coordinate of min corner vector |
max_x | x coordinate of max corner vector |
max_y | y coordinate of max corner vector |
|
inline |
3D bounding box (interval) initialized to the new extreme corner vectors, (min_x,min_y,min_z) and
(max_x,max_y,max_z).
DIM == 3
min_x | x-coordinate of min corner vector |
min_y | y-coordinate of min corner vector |
min_z | z-coordinate of min corner vector |
max_x | x coordinate of max corner vector |
max_y | y coordinate of max corner vector |
max_z | z coordinate of max corner vector |
mi::math::Bbox< T, DIM >::Bbox | ( | InputIterator | first, |
InputIterator | last | ||
) |
|
inlineexplicit |
Template constructor that allows explicit conversions from other bounding boxes with assignment compatible element value type.
|
inline |
Returns the translation of this bounding box by vectors that are inside the scaled bounding box of vectors, i.e., t*vbox
.
vbox
are not emptyvbox | vector bounding box to add |
t | scale parameter. A negative scale inverts vbox . |
|
inline |
Returns the pointer to the first vector, min
.
|
inline |
Returns the pointer to the first vector, min
.
|
inline |
Returns the center point of the bounding box.
|
inline |
Reinitializes this bounding box to the empty space.
The vector min
is set elementwise to mi::base::numeric_traits<T>::max() and the vector max
is set elementwise to mi::base::numeric_traits<T>::negative_max(). This initialization allows to insert points and other bounding boxes; a cleared bounding box will take the value of the first inserted point or bound box.
|
inline |
Returns true
if the point is inside or on the boundary of the bounding box.
|
inline |
Returns the length of the diagonal.
|
inline |
Returns true
if the box is empty.
For example, the box is empty after the default constructor or the clear() method call.
|
inline |
|
inline |
|
inline |
Assigns the union of this bounding box and the other
bounding box to this bounding box.
|
inline |
Assigns the union of this bounding box and the point
to this bounding box.
void mi::math::Bbox< T, DIM >::insert | ( | InputIterator | first, |
InputIterator | last | ||
) |
|
inline |
Returns true
if this bounding box and the other
bounding box intersect in their interiors or on their boundaries.
|
inline |
Returns true
the bounding box is an axis-aligned line.
true
if rank() returns 1
|
inline |
Returns true
the bounding box is an axis-aligned plane.
true
if rank() returns 2
|
inline |
Returns true
the bounding box is a single point.
|
inline |
Returns true
the bounding box has a volume.
true
if rank() returns 3
|
inline |
Returns the index of the dimension in which the bounding box has its largest extent, i.e., 0=x, 1=y, 2=z.
|
inlinestatic |
Constant maximum size of the bounding box.
|
inline |
Conversion to corresponding POD type.
|
inline |
Assignment.
|
inline |
Assignment from corresponding POD type.
|
inline |
Returns the vector min
for i==0
, and the vector max
for i==1
.
|
inline |
Returns the vector min
for i==0
, and the vector max
for i==1
.
|
inline |
Assigns the union of this bounding box and the other
bounding box to this bounding box.
Makes the bounding box compatible with the std::back_inserter
function, which allows you to use STL functions, such as std::copy
to compute the union of a sequence of bounding boxes.
|
inline |
Returns the rank of the bounding box.
void mi::math::Bbox< T, DIM >::robust_grow | ( | T |
eps = T(1.0e-5f) ) |
Robustly grows the bounding box by a value computed automatically from the bounding box dimensions and location in space.
If a bounding box is far away from the origin, just enlarging the bounding box by eps
* (largest box extent) may result in cancellation. To avoid cancellation problems, this method computes the value for enlarging the box by computing coordinatewise the sum of the absolute values of the min and max coordinates and the bounding box extent. It takes then the maximum of all these sums, multiplies it by eps
, adds it to bbox.max
and subtracts it from bbox.min
, enlarging the bounding box by an equal amount on all sides. grow factor
|
inlinestatic |
Constant size of the bounding box.
|
inline |
Returns the volume of the bounding box.
|
static |
Constant dimension of the vectors.
Vector mi::math::Bbox< T, DIM >::max |
Elementwise maximal bounding box corner.
Vector mi::math::Bbox< T, DIM >::min |
Elementwise minimal bounding box corner.
|
static |
Constant size of the bounding box.