Axis-aligned N-dimensional bounding box class template of fixed dimension. More...
#include <bbox.h>
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<T, DIM> &other)=default | |
Default copy constructor. 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... | |
template<typename T2> | |
Bbox (const Bbox_struct<T2, DIM> &other) | |
Template constructor that allows explicit conversions from other POD type 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... | |
Vector | extent () const |
Returns the size 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:
+ - * / == != < > <= >=
.