Math API nvidia_logo_transpbg.gif Up
Bounding Box Class

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 Vectormi::math::Bbox<T, DIM>::pointer
 Mutable pointer to vector. More...
 
typedef const Vectormi::math::Bbox<T, DIM>::const_pointer
 Const pointer to vector. More...
 
typedef Vectormi::math::Bbox<T, DIM>::reference
 Mutable reference to vector. More...
 
typedef const Vectormi::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...
 
Bboxmi::math::Bbox<T, DIM>::operator= (const Bbox &other)
 Assignment. More...
 
Bboxmi::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...
 
Vectormi::math::Bbox<T, DIM>::begin ()
 Returns the pointer to the first vector, min. More...
 
const Vectormi::math::Bbox<T, DIM>::begin () const
 Returns the pointer to the first vector, min. More...
 
Vectormi::math::Bbox<T, DIM>::end ()
 Returns the past-the-end pointer. More...
 
const Vectormi::math::Bbox<T, DIM>::end () const
 Returns the past-the-end pointer. More...
 
Vectormi::math::Bbox<T, DIM>::operator[] (Size i)
 Returns the vector min for i==0, and the vector max for i==1. More...
 
const Vectormi::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...
 
mi::math::Bbox<T, DIM>::volume () const
 Returns the volume of the bounding box. More...
 
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...
 

Detailed Description

An axis-aligned N-dimensional bounding box class template of fixed dimension with supporting functions.

Include File:
#include <mi/math/bbox.h>

Typedef Documentation

 const_pointer

template<typename T , Size DIM>
typedef const Vector* mi::math::Bbox<T, DIM>::const_pointer

Const pointer to vector.

 const_reference

template<typename T , Size DIM>
typedef const Vector& mi::math::Bbox<T, DIM>::const_reference

Const reference to vector.

 difference_type

template<typename T , Size DIM>
typedef Difference mi::math::Bbox<T, DIM>::difference_type

Difference type, signed.

 Pod_type

template<typename T , Size DIM>
typedef Bbox_struct<T,DIM> mi::math::Bbox<T, DIM>::Pod_type

POD class corresponding to this bounding box.

 pointer

template<typename T , Size DIM>
typedef Vector* mi::math::Bbox<T, DIM>::pointer

Mutable pointer to vector.

 reference

template<typename T , Size DIM>
typedef Vector& mi::math::Bbox<T, DIM>::reference

Mutable reference to vector.

 size_type

template<typename T , Size DIM>
typedef Size mi::math::Bbox<T, DIM>::size_type

Size type, unsigned.

 value_type

template<typename T , Size DIM>
typedef Vector mi::math::Bbox<T, DIM>::value_type

Coordinate type.

 Vector

template<typename T , Size DIM>
typedef math::Vector<T,DIM> mi::math::Bbox<T, DIM>::Vector

Corresponding vector type.

Enumeration Type Documentation

 Uninitialized_tag

template<typename T , Size DIM>
enum mi::math::Bbox::Uninitialized_tag

Enum type used to tag a special constructor that does not initialize the elements of the constructed bounding box.

Enumerator
UNINITIALIZED_TAG 

Enum value used to call a special constructor that does not initialize the elements of the constructed bounding box.

Function Documentation

 add_motionbox()

template<typename T , Size DIM>
Bbox mi::math::Bbox<T, DIM>::add_motionbox ( const Bbox<T, DIM> &  vbox,
t 
) const
inline

Returns the translation of this bounding box by vectors that are inside the scaled bounding box of vectors, i.e., t*vbox.

Precondition
this bounding box and vbox are not empty
Parameters
vboxvector bounding box to add
tscale parameter. A negative scale inverts vbox.

 Bbox() [1/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( )
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.

 Bbox() [2/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( const Bbox<T, DIM> &  other)
default

Default copy constructor.

 Bbox() [3/12]

template<typename T , Size DIM>
template<typename T2>
mi::math::Bbox<T, DIM>::Bbox ( const Bbox<T2, DIM> &  other)
inlineexplicit

Template constructor that allows explicit conversions from other bounding boxes with assignment compatible element value type.

 Bbox() [4/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( const Bbox_struct<T, DIM> &  bbox_struct)
inline

Bounding box initialized from corresponding POD type.

 Bbox() [5/12]

template<typename T , Size DIM>
template<typename T2>
mi::math::Bbox<T, DIM>::Bbox ( const Bbox_struct<T2, DIM> &  other)
inlineexplicit

Template constructor that allows explicit conversions from other POD type with assignment compatible element value type.

 Bbox() [6/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( const Vector nmin,
const Vector nmax 
)
inline

Bounding box initialized to the new extreme corner vectors, nmin and nmax.

Parameters
nminmin corner vector
nmaxmax corner vector

 Bbox() [7/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( const Vector point)
inlineexplicit

Bounding box initialized to a single point.

 Bbox() [8/12]

template<typename T , Size DIM>
template<typename InputIterator>
mi::math::Bbox<T, DIM>::Bbox ( InputIterator  first,
InputIterator  last 
)

Constructs a bounding box from a range [first, last) of items.

The value type of InputIterator can be either Vector to insert points, or it can be Bbox to insert bounding boxes.

Parameters
firstfirst element of the sequence to insert
lastpast-the-end position of sequence to insert

 Bbox() [9/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( min_x,
max_x 
)
inline

1D bounding box (interval) initialized to the new extreme corner vectors, (min_x) and (max_x).

Precondition
DIM == 1
Parameters
min_xx-coordinate of min corner vector
max_xx coordinate of max corner vector

 Bbox() [10/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( min_x,
min_y,
max_x,
max_y 
)
inline

2D bounding box (interval) initialized to the new extreme corner vectors, (min_x,min_y) and (max_x,max_y).

Precondition
DIM == 2
Parameters
min_xx-coordinate of min corner vector
min_yy-coordinate of min corner vector
max_xx coordinate of max corner vector
max_yy coordinate of max corner vector

 Bbox() [11/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( min_x,
min_y,
min_z,
max_x,
max_y,
max_z 
)
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).

Precondition
DIM == 3
Parameters
min_xx-coordinate of min corner vector
min_yy-coordinate of min corner vector
min_zz-coordinate of min corner vector
max_xx coordinate of max corner vector
max_yy coordinate of max corner vector
max_zz coordinate of max corner vector

 Bbox() [12/12]

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::Bbox ( Uninitialized_tag  )
inlineexplicit

Bounding box with its elements not initialized.

 begin() [1/2]

template<typename T , Size DIM>
Vector * mi::math::Bbox<T, DIM>::begin ( )
inline

Returns the pointer to the first vector, min.

 begin() [2/2]

template<typename T , Size DIM>
const Vector * mi::math::Bbox<T, DIM>::begin ( ) const
inline

Returns the pointer to the first vector, min.

 center()

template<typename T , Size DIM>
Vector mi::math::Bbox<T, DIM>::center ( ) const
inline

Returns the center point of the bounding box.

 clear()

template<typename T , Size DIM>
void mi::math::Bbox<T, DIM>::clear ( )
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.

 clip()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::clip ( const Bbox<T, DIM> &  bbox1,
const Bbox<T, DIM> &  bbox2 
)
inline

Clip bbox1 at bbox2 and return the result.

I.e., the resulting bbox is the intersection of bbox1 with bbox2.

Parameters
bbox1first bounding box
bbox2second bounding box

 contains()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::contains ( const Vector vec) const
inline

Returns true if the point is inside or on the boundary of the bounding box.

 diagonal_length()

template<typename T , Size DIM>
T mi::math::Bbox<T, DIM>::diagonal_length ( ) const
inline

Returns the length of the diagonal.

Precondition
the bounding box is not empty

 empty()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::empty ( ) const
inline

Returns true if the box is empty.

For example, the box is empty after the default constructor or the clear() method call.

 end() [1/2]

template<typename T , Size DIM>
Vector * mi::math::Bbox<T, DIM>::end ( )
inline

Returns the past-the-end pointer.

The range [begin(),end()) forms the range [min,max].

 end() [2/2]

template<typename T , Size DIM>
const Vector * mi::math::Bbox<T, DIM>::end ( ) const
inline

Returns the past-the-end pointer.

The range [begin(),end()) forms the range [min,max].

 extent()

template<typename T , Size DIM>
Vector mi::math::Bbox<T, DIM>::extent ( ) const
inline

Returns the size of the bounding box.

 insert() [1/3]

template<typename T , Size DIM>
void mi::math::Bbox<T, DIM>::insert ( const Bbox<T, DIM> &  other)
inline

Assigns the union of this bounding box and the other bounding box to this bounding box.

 insert() [2/3]

template<typename T , Size DIM>
void mi::math::Bbox<T, DIM>::insert ( const Vector point)
inline

Assigns the union of this bounding box and the point to this bounding box.

 insert() [3/3]

template<typename T , Size DIM>
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.

The value type of InputIterator can be either Vector to insert points, or it can be Bbox to insert bounding boxes.

Parameters
firstfirst element of the sequence to insert
lastpast-the-end position of sequence to insert

 intersects()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::intersects ( const Bbox<T, DIM> &  other) const
inline

Returns true if this bounding box and the other bounding box intersect in their interiors or on their boundaries.

 is_line()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::is_line ( ) const
inline

Returns true the bounding box is an axis-aligned line.

Returns
true if rank() returns 1

 is_plane()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::is_plane ( ) const
inline

Returns true the bounding box is an axis-aligned plane.

Returns
true if rank() returns 2

 is_point()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::is_point ( ) const
inline

Returns true the bounding box is a single point.

 is_volume()

template<typename T , Size DIM>
bool mi::math::Bbox<T, DIM>::is_volume ( ) const
inline

Returns true the bounding box has a volume.

Returns
true if rank() returns 3

 largest_extent_index()

template<typename T , Size DIM>
Size mi::math::Bbox<T, DIM>::largest_extent_index ( ) const
inline

Returns the index of the dimension in which the bounding box has its largest extent, i.e., 0=x, 1=y, 2=z.

 lerp()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::lerp ( const Bbox<T, DIM> &  bbox1,
const Bbox<T, DIM> &  bbox2,
t 
)
inline

Returns the linear interpolation between bbox1 and bbox2, i.e., it returns (1-t) * bbox1 + t * bbox2.

Precondition
bbox1 and bbox2 are not empty.
Parameters
bbox1one bounding box
bbox2second bounding box
tinterpolation parameter in [0,1]

 max_size()

template<typename T , Size DIM>
static Size mi::math::Bbox<T, DIM>::max_size ( )
inlinestatic

Constant maximum size of the bounding box.

 operator Bbox_struct<T, DIM>()

template<typename T , Size DIM>
mi::math::Bbox<T, DIM>::operator Bbox_struct<T, DIM> ( ) const
inline

Conversion to corresponding POD type.

 operator!=()

template<typename T , Size DIM>
bool mi::math::operator!= ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is elementwise not equal to rhs.

 operator*()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::operator* ( const Bbox<T, DIM> &  bbox,
factor 
)
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.

Precondition
bbox is not empty

 operator*=()

template<typename T , Size DIM>
Bbox<T, DIM> & mi::math::operator*= ( Bbox<T, DIM> &  bbox,
factor 
)
inline

Scales bbox by factor, i.e., bbox.max and bbox.min are multiplied by factor.

Precondition
bbox is not empty

 operator+()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::operator+ ( const Bbox<T, DIM> &  bbox,
value 
)
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.

Precondition
bbox is not empty

 operator+=()

template<typename T , Size DIM>
Bbox<T, DIM> & mi::math::operator+= ( Bbox<T, DIM> &  bbox,
value 
)
inline

Increases bbox by a constant value at each face, i.e., value is added to bbox.max and subtracted from bbox.min.

Precondition
bbox is not empty

 operator-()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::operator- ( const Bbox<T, DIM> &  bbox,
value 
)
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.

Precondition
bbox is not empty

 operator-=()

template<typename T , Size DIM>
Bbox<T, DIM> & mi::math::operator-= ( Bbox<T, DIM> &  bbox,
value 
)
inline

Shrinks bbox by a constant value at each face, i.e., value is subtracted from bbox.max and added to bbox.min.

Precondition
bbox is not empty

 operator/()

template<typename T , Size DIM>
Bbox<T, DIM> mi::math::operator/ ( const Bbox<T, DIM> &  bbox,
divisor 
)
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.

Precondition
bbox is not empty and divisor is not zero

 operator/=()

template<typename T , Size DIM>
Bbox<T, DIM> & mi::math::operator/= ( Bbox<T, DIM> &  bbox,
divisor 
)
inline

Divide bbox by divisor, i.e., bbox.max and bbox.min are divided by divisor.

Precondition
bbox is not empty and divisor is not zero

 operator<()

template<typename T , Size DIM>
bool mi::math::operator< ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is lexicographically less than rhs.

See also
Definition: Lexicographic order and comparison

 operator<=()

template<typename T , Size DIM>
bool mi::math::operator<= ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is lexicographically less than or equal to rhs.

See also
Definition: Lexicographic order and comparison

 operator=() [1/2]

template<typename T , Size DIM>
Bbox & mi::math::Bbox<T, DIM>::operator= ( const Bbox<T, DIM> &  other)
inline

Assignment.

 operator=() [2/2]

template<typename T , Size DIM>
Bbox & mi::math::Bbox<T, DIM>::operator= ( const Bbox_struct<T, DIM> &  other)
inline

Assignment from corresponding POD type.

 operator==()

template<typename T , Size DIM>
bool mi::math::operator== ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is elementwise equal to rhs.

 operator>()

template<typename T , Size DIM>
bool mi::math::operator> ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is lexicographically greater than rhs.

See also
Definition: Lexicographic order and comparison

 operator>=()

template<typename T , Size DIM>
bool mi::math::operator>= ( const Bbox<T, DIM> &  lhs,
const Bbox<T, DIM> &  rhs 
)
inline

Returns true if lhs is lexicographically greater than or equal to rhs.

See also
Definition: Lexicographic order and comparison

 operator[]() [1/2]

template<typename T , Size DIM>
Vector & mi::math::Bbox<T, DIM>::operator[] ( Size  i)
inline

Returns the vector min for i==0, and the vector max for i==1.

 operator[]() [2/2]

template<typename T , Size DIM>
const Vector & mi::math::Bbox<T, DIM>::operator[] ( Size  i) const
inline

Returns the vector min for i==0, and the vector max for i==1.

 push_back()

template<typename T , Size DIM>
void mi::math::Bbox<T, DIM>::push_back ( const Bbox<T, DIM> &  other)
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.

 rank()

template<typename T , Size DIM>
Size mi::math::Bbox<T, DIM>::rank ( ) const
inline

Returns the rank of the bounding box.

Returns
0 if the bounding box is a point or empty, 1 if it is an axis-aligned line, 2 if it is an axis-aligned plane, and 3 if it has a volume.

 robust_grow()

template<typename T , Size DIM>
void mi::math::Bbox<T, DIM>::robust_grow ( 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

 size()

template<typename T , Size DIM>
static Size mi::math::Bbox<T, DIM>::size ( )
inlinestatic

Constant size of the bounding box.

 transform_point()

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.

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.

Note
The transformed bounding box is likely to be a more pessimistic approximation of a geometry that was approximated by the original bounding box. Transforming the approximated geometry and computing a new bounding box gives usually a tighter bounding box.
Parameters
mat4x4 transformation matrix
bboxthe bounding box to transform

 transform_vector()

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.

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.

Parameters
mat4x4 transformation matrix
bboxthe bounding box to transform

 volume()

template<typename T , Size DIM>
T mi::math::Bbox<T, DIM>::volume ( ) const
inline

Returns the volume of the bounding box.

Variable Documentation

 DIMENSION

template<typename T , Size DIM>
const Size mi::math::Bbox<T, DIM>::DIMENSION = DIM
static

Constant dimension of the vectors.

 max [1/2]

template<typename T , Size DIM>
Vector_struct<T,DIM> mi::math::Bbox_struct<T, DIM>::max

Elementwise maximal bounding box corner.

 max [2/2]

template<typename T , Size DIM>
Vector mi::math::Bbox<T, DIM>::max

Elementwise maximal bounding box corner.

 min [1/2]

template<typename T , Size DIM>
Vector_struct<T,DIM> mi::math::Bbox_struct<T, DIM>::min

Elementwise minimal bounding box corner.

 min [2/2]

template<typename T , Size DIM>
Vector mi::math::Bbox<T, DIM>::min

Elementwise minimal bounding box corner.

 SIZE

template<typename T , Size DIM>
const Size mi::math::Bbox<T, DIM>::SIZE = 2
static

Constant size of the bounding box.