HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Box< V > Class Template Reference

#include <ImathBox.h>

Public Member Functions

Constructors
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box () IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const V &point) IMATH_NOEXCEPT
 Construct a bounding box that contains a single point. More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const V &minV, const V &maxV) IMATH_NOEXCEPT
 Construct a bounding box with the given minimum and maximum values. More...
 
Comparison
IMATH_HOSTDEVICE constexpr bool operator== (const Box< V > &src) const IMATH_NOEXCEPT
 Equality. More...
 
IMATH_HOSTDEVICE constexpr bool operator!= (const Box< V > &src) const IMATH_NOEXCEPT
 Inequality. More...
 
Manipulation
IMATH_HOSTDEVICE void makeEmpty () IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE void extendBy (const V &point) IMATH_NOEXCEPT
 Extend the box to include the given point. More...
 
IMATH_HOSTDEVICE void extendBy (const Box< V > &box) IMATH_NOEXCEPT
 Extend the box to include the given box. More...
 
IMATH_HOSTDEVICE void makeInfinite () IMATH_NOEXCEPT
 Make the box include the entire range of V. More...
 
Query
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 V 
size () const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE constexpr V center () const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
intersects (const V &point) const IMATH_NOEXCEPT
 Return true if the given point is inside the box, false otherwise. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
intersects (const Box< V > &box) const IMATH_NOEXCEPT
 Return true if the given box is inside the box, false otherwise. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 unsigned int 
majorAxis () const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
isEmpty () const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
hasVolume () const IMATH_NOEXCEPT
 Return true if the box is larger than a single point, false otherwise. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
isInfinite () const IMATH_NOEXCEPT
 

Public Attributes

Direct access to bounds
min
 The minimum value of the box. More...
 
max
 The maximum value of the box. More...
 

Detailed Description

template<class V>
class Box< V >

The Box<V> template represents an axis-aligned bounding box defined by minimum and maximum values of type V. The min and max members are public.

The type V is typically an Imath vector (i.e. V2i, V3f, etc) and must implement an index operator[] that returns a type (typically as scalar) that supports assignment, comparison, and arithmetic operators.

V must also provide a constructor that takes a float and/or double for use in initializing the box.

V must also provide a function V::dimensions() which returns the number of dimensions in the class (since its assumed its a vector) – preferably, this returns a constant expression, typically 2 or 3.

Definition at line 37 of file ImathBox.h.

Constructor & Destructor Documentation

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box< V >::Box ( )
inline

Construct an empty bounding box. This initializes the mimimum to std::numeric_limits<V::baseType>::max() and the maximum to std::numeric_limits<V::baseType>::lowest().

Definition at line 170 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box< V >::Box ( const V &  point)
inline

Construct a bounding box that contains a single point.

Definition at line 176 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box< V >::Box ( const V &  minV,
const V &  maxV 
)
inline

Construct a bounding box with the given minimum and maximum values.

Definition at line 183 of file ImathBox.h.

Member Function Documentation

template<class V >
IMATH_HOSTDEVICE constexpr V Box< V >::center ( ) const
inline

Return the center of the box. The center is defined as (max+min)/2. The center of an empty box is undefined.

Definition at line 285 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE void Box< V >::extendBy ( const V &  point)
inline

Extend the box to include the given point.

Definition at line 221 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE void Box< V >::extendBy ( const Box< V > &  box)
inline

Extend the box to include the given box.

Definition at line 235 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Box< V >::hasVolume ( ) const
inline

Return true if the box is larger than a single point, false otherwise.

Definition at line 318 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Box< V >::intersects ( const V &  point) const
inline

Return true if the given point is inside the box, false otherwise.

Definition at line 249 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Box< V >::intersects ( const Box< V > &  box) const
inline

Return true if the given box is inside the box, false otherwise.

Definition at line 262 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Box< V >::isEmpty ( ) const
inline

Return true if the box is empty, false otherwise. An empty box's minimum is greater than its maximum.

Definition at line 292 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool Box< V >::isInfinite ( ) const
inline

Return true if the box contains all points, false otherwise. An infinite box has a mimimum ofV::baseTypeLowest() and a maximum of V::baseTypeMax().

Definition at line 305 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int Box< V >::majorAxis ( ) const
inline

Return the major axis of the box. The major axis is the dimension with the greatest difference between maximum and minimum.

Definition at line 331 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE void Box< V >::makeEmpty ( )
inline

Set the box to be empty. A box is empty if the mimimum is greater than the maximum. makeEmpty() sets the mimimum to V::baseTypeMax() and the maximum to V::baseTypeLowest().

Definition at line 205 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE void Box< V >::makeInfinite ( )
inline

Make the box include the entire range of V.

Definition at line 213 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE constexpr bool Box< V >::operator!= ( const Box< V > &  src) const
inline

Inequality.

Definition at line 198 of file ImathBox.h.

template<class V>
IMATH_HOSTDEVICE constexpr bool Box< V >::operator== ( const Box< V > &  src) const
inline

Equality.

Definition at line 191 of file ImathBox.h.

template<class V >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 V Box< V >::size ( void  ) const
inline

Return the size of the box. The size is of type V, defined as (max-min). An empty box has a size of V(0), i.e. 0 in each dimension.

Definition at line 275 of file ImathBox.h.

Member Data Documentation

template<class V>
V Box< V >::max

The maximum value of the box.

Definition at line 48 of file ImathBox.h.

template<class V>
V Box< V >::min

The minimum value of the box.

Definition at line 45 of file ImathBox.h.


The documentation for this class was generated from the following file: