An axis-aligned N-dimensional bounding box class template of fixed dimension with supporting functions. More...
Classes | |
struct | mi::math::Bbox_struct<T, DIM> |
Storage class for an axis-aligned N-dimensional bounding box class template of fixed dimension. More... | |
class | mi::math::Bbox<T, DIM> |
Axis-aligned N-dimensional bounding box class template of fixed dimension. More... | |
Typedefs | |
typedef math::Vector<T, DIM> | mi::math::Bbox<T, DIM>::Vector |
Corresponding vector type. More... | |
typedef Bbox_struct<T, DIM> | mi::math::Bbox<T, DIM>::Pod_type |
POD class corresponding to this bounding box. More... | |
typedef Vector | mi::math::Bbox<T, DIM>::value_type |
Coordinate type. More... | |
typedef Size | mi::math::Bbox<T, DIM>::size_type |
Size type, unsigned. More... | |
typedef Difference | mi::math::Bbox<T, DIM>::difference_type |
Difference type, signed. More... | |
typedef Vector * | mi::math::Bbox<T, DIM>::pointer |
Mutable pointer to vector. More... | |
typedef const Vector * | mi::math::Bbox<T, DIM>::const_pointer |
Const pointer to vector. More... | |
typedef Vector & | mi::math::Bbox<T, DIM>::reference |
Mutable reference to vector. More... | |
typedef const Vector & | mi::math::Bbox<T, DIM>::const_reference |
Const reference to vector. More... | |
Enumerations | |
enum | mi::math::Bbox<T, DIM>::Uninitialized_tag { mi::math::Bbox<T, DIM>::UNINITIALIZED_TAG } |
Enum type used to tag a special constructor that does not initialize the elements of the constructed bounding box. More... | |
Functions | |
static Size | mi::math::Bbox<T, DIM>::size () |
Constant size of the bounding box. More... | |
static Size | mi::math::Bbox<T, DIM>::max_size () |
Constant maximum size of the bounding box. More... | |
void | mi::math::Bbox<T, DIM>::clear () |
Reinitializes this bounding box to the empty space. More... | |
mi::math::Bbox<T, DIM>::Bbox () | |
Bounding box initialized to the empty space, see also the clear function. More... | |
mi::math::Bbox<T, DIM>::Bbox (Uninitialized_tag) | |
Bounding box with its elements not initialized. More... | |
mi::math::Bbox<T, DIM>::Bbox (const Bbox<T, DIM> &other)=default | |
Default copy constructor. More... | |
mi::math::Bbox<T, DIM>::Bbox (const Bbox_struct<T, DIM> &bbox_struct) | |
Bounding box initialized from corresponding POD type. More... | |
mi::math::Bbox<T, DIM>::Bbox (const Vector &point) | |
Bounding box initialized to a single point . More... | |
mi::math::Bbox<T, DIM>::Bbox (const Vector &nmin, const Vector &nmax) | |
Bounding box initialized to the new extreme corner vectors, nmin and nmax . More... | |
mi::math::Bbox<T, DIM>::Bbox (T min_x, T max_x) | |
1D bounding box (interval) initialized to the new extreme corner vectors, (min_x) and (max_x). More... | |
mi::math::Bbox<T, DIM>::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... | |
mi::math::Bbox<T, DIM>::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> | |
mi::math::Bbox<T, DIM>::Bbox (InputIterator first, InputIterator last) | |
Constructs a bounding box from a range [first , last ) of items. More... | |
template<typename T2> | |
mi::math::Bbox<T, DIM>::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> | |
mi::math::Bbox<T, DIM>::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 & | mi::math::Bbox<T, DIM>::operator= (const Bbox &other) |
Assignment. More... | |
Bbox & | mi::math::Bbox<T, DIM>::operator= (const Bbox_struct<T, DIM> &other) |
Assignment from corresponding POD type. More... | |
mi::math::Bbox<T, DIM>::operator Bbox_struct<T, DIM> () const | |
Conversion to corresponding POD type. More... | |
Vector * | mi::math::Bbox<T, DIM>::begin () |
Returns the pointer to the first vector, min . More... | |
const Vector * | mi::math::Bbox<T, DIM>::begin () const |
Returns the pointer to the first vector, min . More... | |
Vector * | mi::math::Bbox<T, DIM>::end () |
Returns the past-the-end pointer. More... | |
const Vector * | mi::math::Bbox<T, DIM>::end () const |
Returns the past-the-end pointer. More... | |
Vector & | mi::math::Bbox<T, DIM>::operator[] (Size i) |
Returns the vector min for i==0 , and the vector max for i==1 . More... | |
const Vector & | mi::math::Bbox<T, DIM>::operator[] (Size i) const |
Returns the vector min for i==0 , and the vector max for i==1 . More... | |
bool | mi::math::Bbox<T, DIM>::empty () const |
Returns true if the box is empty. More... | |
Size | mi::math::Bbox<T, DIM>::rank () const |
Returns the rank of the bounding box. More... | |
bool | mi::math::Bbox<T, DIM>::is_point () const |
Returns true the bounding box is a single point. More... | |
bool | mi::math::Bbox<T, DIM>::is_line () const |
Returns true the bounding box is an axis-aligned line. More... | |
bool | mi::math::Bbox<T, DIM>::is_plane () const |
Returns true the bounding box is an axis-aligned plane. More... | |
bool | mi::math::Bbox<T, DIM>::is_volume () const |
Returns true the bounding box has a volume. More... | |
bool | mi::math::Bbox<T, DIM>::contains (const Vector &vec) const |
Returns true if the point is inside or on the boundary of the bounding box. More... | |
bool | mi::math::Bbox<T, DIM>::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 | mi::math::Bbox<T, DIM>::insert (const Bbox &other) |
Assigns the union of this bounding box and the other bounding box to this bounding box. More... | |
void | mi::math::Bbox<T, DIM>::insert (const Vector &point) |
Assigns the union of this bounding box and the point to this bounding box. More... | |
template<typename InputIterator> | |
void | mi::math::Bbox<T, DIM>::insert (InputIterator first, InputIterator last) |
Inserts a range [first ,last ) of items into this bounding box. More... | |
Bbox | mi::math::Bbox<T, DIM>::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 | mi::math::Bbox<T, DIM>::push_back (const Bbox &other) |
Assigns the union of this bounding box and the other bounding box to this bounding box. More... | |
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. More... | |
T | mi::math::Bbox<T, DIM>::volume () const |
Returns the volume of the bounding box. More... | |
T | mi::math::Bbox<T, DIM>::diagonal_length () const |
Returns the length of the diagonal. More... | |
Size | mi::math::Bbox<T, DIM>::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 | mi::math::Bbox<T, DIM>::center () const |
Returns the center point of the bounding box. More... | |
Vector | mi::math::Bbox<T, DIM>::extent () const |
Returns the size of the bounding box. More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::operator+ (const Bbox<T, DIM> &bbox, T value) |
Returns a bounding box that is the bbox increased by a constant value at each face, i.e., value is added to bbox.max and subtracted from bbox.min . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::operator- (const Bbox<T, DIM> &bbox, T value) |
Returns a bounding box that is the bbox shrunk by a constant value at each face, i.e., value is subtracted from bbox.max and added to bbox.min . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::operator* (const Bbox<T, DIM> &bbox, T factor) |
Returns a bounding box that is a version of bbox scaled by factor , i.e., bbox.max and bbox.min are multiplied by factor . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::operator/ (const Bbox<T, DIM> &bbox, T divisor) |
Returns a bounding box that is a version of bbox divided by divisor , i.e., bbox.max and bbox.min are divided by divisor . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> & | mi::math::operator+= (Bbox<T, DIM> &bbox, T value) |
Increases bbox by a constant value at each face, i.e., value is added to bbox.max and subtracted from bbox.min . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> & | mi::math::operator-= (Bbox<T, DIM> &bbox, T value) |
Shrinks bbox by a constant value at each face, i.e., value is subtracted from bbox.max and added to bbox.min . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> & | mi::math::operator*= (Bbox<T, DIM> &bbox, T factor) |
Scales bbox by factor , i.e., bbox.max and bbox.min are multiplied by factor . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> & | mi::math::operator/= (Bbox<T, DIM> &bbox, T divisor) |
Divide bbox by divisor , i.e., bbox.max and bbox.min are divided by divisor . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator== (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is elementwise equal to rhs . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator!= (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is elementwise not equal to rhs . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator< (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is lexicographically less than rhs . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator<= (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is lexicographically less than or equal to rhs . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator> (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is lexicographically greater than rhs . More... | |
template<typename T , Size DIM> | |
bool | mi::math::operator>= (const Bbox<T, DIM> &lhs, const Bbox<T, DIM> &rhs) |
Returns true if lhs is lexicographically greater than or equal to rhs . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::lerp (const Bbox<T, DIM> &bbox1, const Bbox<T, DIM> &bbox2, T t) |
Returns the linear interpolation between bbox1 and bbox2 , i.e., it returns (1-t) * bbox1 + t * bbox2 . More... | |
template<typename T , Size DIM> | |
Bbox<T, DIM> | mi::math::clip (const Bbox<T, DIM> &bbox1, const Bbox<T, DIM> &bbox2) |
Clip bbox1 at bbox2 and return the result. More... | |
template<typename TT , typename T> | |
Bbox<T, 3> | mi::math::transform_point (const Matrix<TT, 4, 4> &mat, const Bbox<T, 3> &bbox) |
Returns the 3D bounding box transformed by a matrix. More... | |
template<typename TT , typename T> | |
Bbox<T, 3> | mi::math::transform_vector (const Matrix<TT, 4, 4> &mat, const Bbox<T, 3> &bbox) |
Returns the 3D bounding box transformed by a matrix. More... | |
Variables | |
Vector_struct<T, DIM> | mi::math::Bbox_struct<T, DIM>::min |
Elementwise minimal bounding box corner. More... | |
Vector_struct<T, DIM> | mi::math::Bbox_struct<T, DIM>::max |
Elementwise maximal bounding box corner. More... | |
static const Size | mi::math::Bbox<T, DIM>::DIMENSION = DIM |
Constant dimension of the vectors. More... | |
static const Size | mi::math::Bbox<T, DIM>::SIZE = 2 |
Constant size of the bounding box. More... | |
Vector | mi::math::Bbox<T, DIM>::min |
Elementwise minimal bounding box corner. More... | |
Vector | mi::math::Bbox<T, DIM>::max |
Elementwise maximal bounding box corner. More... | |
An axis-aligned N-dimensional bounding box class template of fixed dimension with supporting functions.
#include <mi/math/bbox.h>
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 |
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 |
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.
|
default |
Default copy constructor.
|
inlineexplicit |
Template constructor that allows explicit conversions from other bounding boxes with assignment compatible element value type.
|
inline |
Bounding box initialized from corresponding POD type.
|
inlineexplicit |
Template constructor that allows explicit conversions from other POD type with assignment compatible element value type.
|
inline |
Bounding box initialized to the new extreme corner vectors, nmin
and nmax
.
nmin | min corner vector |
nmax | max corner vector |
|
inlineexplicit |
Bounding box initialized to a single point
.
mi::math::Bbox<T, DIM>::Bbox | ( | InputIterator | first, |
InputIterator | last | ||
) |
|
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 |
|
inlineexplicit |
Bounding box with its elements not initialized.
|
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 |
Clip bbox1
at bbox2
and return the result.
I.e., the resulting bbox is the intersection of bbox1
with bbox2
.
bbox1 | first bounding box |
bbox2 | second bounding 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 |
Returns the size of the bounding box.
|
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.
|
inline |
Returns the linear interpolation between bbox1
and bbox2
, i.e., it returns (1-t) * bbox1 + t * bbox2
.
bbox1
and bbox2
are not empty. bbox1 | one bounding box |
bbox2 | second bounding box |
t | interpolation parameter in [0,1] |
|
inlinestatic |
Constant maximum size of the bounding box.
|
inline |
Conversion to corresponding POD type.
|
inline |
Returns true
if lhs
is elementwise not equal to rhs
.
|
inline |
Returns a bounding box that is a version of bbox
scaled by factor
, i.e., bbox.max
and bbox.min
are multiplied by factor
.
bbox
is not empty
|
inline |
Scales bbox
by factor
, i.e., bbox.max
and bbox.min
are multiplied by factor
.
bbox
is not empty
|
inline |
Returns a bounding box that is the bbox
increased by a constant value
at each face, i.e., value
is added to bbox.max
and subtracted from bbox.min
.
bbox
is not empty
|
inline |
Increases bbox
by a constant value
at each face, i.e., value
is added to bbox.max
and subtracted from bbox.min
.
bbox
is not empty
|
inline |
Returns a bounding box that is the bbox
shrunk by a constant value
at each face, i.e., value
is subtracted from bbox.max
and added to bbox.min
.
bbox
is not empty
|
inline |
Shrinks bbox
by a constant value
at each face, i.e., value
is subtracted from bbox.max
and added to bbox.min
.
bbox
is not empty
|
inline |
Returns a bounding box that is a version of bbox
divided by divisor
, i.e., bbox.max
and bbox.min
are divided by divisor
.
bbox
is not empty and divisor
is not zero
|
inline |
Divide bbox
by divisor
, i.e., bbox.max
and bbox.min
are divided by divisor
.
bbox
is not empty and divisor
is not zero
|
inline |
Returns true
if lhs
is lexicographically less than rhs
.
|
inline |
Returns true
if lhs
is lexicographically less than or equal to rhs
.
|
inline |
Assignment.
|
inline |
Assignment from corresponding POD type.
|
inline |
Returns true
if lhs
is elementwise equal to rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than or equal to rhs
.
|
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.
Bbox<T, 3> mi::math::transform_point | ( | const Matrix<TT, 4, 4> & | mat, |
const Bbox<T, 3> & | bbox | ||
) |
Returns the 3D bounding box transformed by a matrix.
The transformation (including the translation) is applied to the eight bounding box corners (interpreted as points) and a new axis aligned bounding box is computed for these transformed corners.
mat | 4x4 transformation matrix |
bbox | the bounding box to transform |
Bbox<T, 3> mi::math::transform_vector | ( | const Matrix<TT, 4, 4> & | mat, |
const Bbox<T, 3> & | bbox | ||
) |
Returns the 3D bounding box transformed by a matrix.
The transformation (excluding the translation) is applied to the eight bounding box corners (interpreted as vectors) and a new axis aligned bounding box is computed for these transformed corners.
mat | 4x4 transformation matrix |
bbox | the bounding box to transform |
|
inline |
Returns the volume of the bounding box.
|
static |
Constant dimension of the vectors.
Vector_struct<T,DIM> mi::math::Bbox_struct<T, DIM>::max |
Elementwise maximal bounding box corner.
Vector mi::math::Bbox<T, DIM>::max |
Elementwise maximal bounding box corner.
Vector_struct<T,DIM> mi::math::Bbox_struct<T, DIM>::min |
Elementwise minimal bounding box corner.
Vector mi::math::Bbox<T, DIM>::min |
Elementwise minimal bounding box corner.
|
static |
Constant size of the bounding box.