NVIDIA Iray: Math API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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...
 

Functions

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...
 

Detailed Description

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

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

Function Documentation

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
bbox1 first bounding box
bbox2 second bounding box
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
bbox1 one bounding box
bbox2 second bounding box
t interpolation parameter in [0,1]
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.

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
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
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
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
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
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
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
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
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
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
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.

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
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
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
mat 4x4 transformation matrix
bbox the bounding box to transform
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
mat 4x4 transformation matrix
bbox the bounding box to transform