Hermes
hermes::BBox3< T > Class Template Reference

Public Member Functions

HERMES_DEVICE_CALLABLE BBox3 ()
 Creates an empty bounding box.
 
HERMES_DEVICE_CALLABLE BBox3 (const Point3< T > &p)
 
HERMES_DEVICE_CALLABLE BBox3 (const Point3< T > &c, real_t r)
 
HERMES_DEVICE_CALLABLE BBox3 (const Point3< T > &p1, const Point3< T > &p2)
 
HERMES_DEVICE_CALLABLE bool contains (const Point3< T > &p) const
 
HERMES_DEVICE_CALLABLE bool contains (const BBox3 &b) const
 
HERMES_DEVICE_CALLABLE bool containsExclusive (const Point3< T > &p) const
 
HERMES_DEVICE_CALLABLE void expand (real_t delta)
 
HERMES_DEVICE_CALLABLE Vector3< T > diagonal () const
 
HERMES_DEVICE_CALLABLE int maxExtent () const
 
HERMES_DEVICE_CALLABLE Vector3< T > offset (const Point3< T > &p) const
 
HERMES_DEVICE_CALLABLEsurfaceArea () const
 
HERMES_DEVICE_CALLABLEvolume () const
 
std::vector< BBox3splitBy8 () const
 
HERMES_DEVICE_CALLABLE Point3< T > center () const
 
HERMES_DEVICE_CALLABLE Point3< T > centroid () const
 
HERMES_DEVICE_CALLABLEsize (u32 d) const
 
HERMES_DEVICE_CALLABLE const Point3< T > & operator[] (int i) const
 
HERMES_DEVICE_CALLABLE Point3< T > & operator[] (int i)
 
HERMES_DEVICE_CALLABLE Point3< T > corner (int c) const
 
HERMES_DEVICE_CALLABLE BBox2< T > xy () const
 
HERMES_DEVICE_CALLABLE BBox2< T > yz () const
 
HERMES_DEVICE_CALLABLE BBox2< T > xz () const
 

Static Public Member Functions

static HERMES_DEVICE_CALLABLE BBox3 unitBox (bool centroid_center=false)
 

Public Attributes

Point3< T > lower
 
Point3< T > upper
 

Detailed Description

template<typename T>
class hermes::BBox3< T >

Axis-aligned region of space.

Template Parameters
Tcoordinates type

Constructor & Destructor Documentation

◆ BBox3() [1/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::BBox3< T >::BBox3 ( const Point3< T > &  p)
inlineexplicit

Creates a bounding enclosing a single point

Parameters
ppoint

◆ BBox3() [2/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::BBox3< T >::BBox3 ( const Point3< T > &  c,
real_t  r 
)
inline

Creates a bounding box of 2r side centered at c

Parameters
ccenter point
rradius

◆ BBox3() [3/3]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::BBox3< T >::BBox3 ( const Point3< T > &  p1,
const Point3< T > &  p2 
)
inline

Creates a bounding box enclosing two points

Parameters
p1first point
p2second point

Member Function Documentation

◆ contains() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::BBox3< T >::contains ( const BBox3< T > &  b) const
inline
Parameters
bbbox
Returns
true if bbox is fully inside

◆ contains() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::BBox3< T >::contains ( const Point3< T > &  p) const
inline
Parameters
p
Returns
true if this bounding box encloses p

◆ containsExclusive()

template<typename T >
HERMES_DEVICE_CALLABLE bool hermes::BBox3< T >::containsExclusive ( const Point3< T > &  p) const
inline

Doesn't consider points on the upper boundary to be inside the bbox

Parameters
ppoint
Returns
true if contains exclusive

◆ corner()

template<typename T >
HERMES_DEVICE_CALLABLE Point3<T> hermes::BBox3< T >::corner ( int  c) const
inline
Parameters
ccorner index
Returns
corner point

◆ diagonal()

template<typename T >
HERMES_DEVICE_CALLABLE Vector3<T> hermes::BBox3< T >::diagonal ( ) const
inline
Returns
vector along the diagonal upper - lower

◆ expand()

template<typename T >
HERMES_DEVICE_CALLABLE void hermes::BBox3< T >::expand ( real_t  delta)
inline

Pads the bbox in both dimensions

Parameters
deltaexpansion factor (lower - delta, upper + delta)

◆ maxExtent()

template<typename T >
HERMES_DEVICE_CALLABLE int hermes::BBox3< T >::maxExtent ( ) const
inline
Returns
index of longest axis

◆ offset()

template<typename T >
HERMES_DEVICE_CALLABLE Vector3<T> hermes::BBox3< T >::offset ( const Point3< T > &  p) const
inline
Parameters
ppoint
Returns
position of p relative to the corners where lower has offset (0,0,0) and upper (1,1,1)

◆ operator[]() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE Point3<T>& hermes::BBox3< T >::operator[] ( int  i)
inline
Parameters
i0 = lower, 1 = upper
Returns
lower or upper point

◆ operator[]() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE const Point3<T>& hermes::BBox3< T >::operator[] ( int  i) const
inline
Parameters
i0 = lower, 1 = upper
Returns
lower or upper point

◆ splitBy8()

template<typename T >
std::vector<BBox3> hermes::BBox3< T >::splitBy8 ( ) const
inline

y |_ x z / 2 / 3 /

/ 6 / 7 /

| 0 | 1 |

| 4 | 5 |

◆ surfaceArea()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::BBox3< T >::surfaceArea ( ) const
inline
Returns
surface area of the six faces

◆ volume()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::BBox3< T >::volume ( ) const
inline
Returns
volume inside the bounds

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