HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT::BVH< N > Class Template Reference

#include <UT_BVH.h>

Classes

struct  Node
 

Public Types

using INT_TYPE = uint
 

Public Member Functions

SYS_FORCE_INLINE BVH () noexcept
 
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE = INT_TYPE>
void init (const BOX_TYPE *boxes, const INT_TYPE nboxes, SRC_INT_TYPE *indices=nullptr, bool reorder_indices=false, INT_TYPE max_items_per_leaf=1) noexcept
 
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE = INT_TYPE>
void init (Box< T, NAXES > axes_minmax, const BOX_TYPE *boxes, INT_TYPE nboxes, SRC_INT_TYPE *indices=nullptr, bool reorder_indices=false, INT_TYPE max_items_per_leaf=1) noexcept
 
SYS_FORCE_INLINE INT_TYPE getNumNodes () const noexcept
 
SYS_FORCE_INLINE const NodegetNodes () const noexcept
 
int getMaxDepth () const noexcept
 Returns the maximum depth of any leaf. More...
 
int getPureInternalDepth () const noexcept
 Returns the minimum depth of the first non-internal node. More...
 
SYS_FORCE_INLINE void clear () noexcept
 
template<typename LOCAL_DATA , typename FUNCTORS >
void traverse (FUNCTORS &functors, LOCAL_DATA *data_for_parent=nullptr) const noexcept
 
template<typename LOCAL_DATA , typename FUNCTORS >
void traverseParallel (INT_TYPE parallel_threshold, FUNCTORS &functors, LOCAL_DATA *data_for_parent=nullptr) const noexcept
 
template<typename LOCAL_DATA , typename FUNCTORS >
void traverseVector (FUNCTORS &functors, LOCAL_DATA *data_for_parent=nullptr) const noexcept
 
void debugDump () const
 Prints a text representation of the tree to stdout. More...
 

Static Public Member Functions

template<typename SRC_INT_TYPE >
static void createTrivialIndices (SRC_INT_TYPE *indices, const INT_TYPE n) noexcept
 

Detailed Description

template<uint N>
class UT::BVH< N >

Definition at line 372 of file UT_BVH.h.

Member Typedef Documentation

template<uint N>
using UT::BVH< N >::INT_TYPE = uint

Definition at line 374 of file UT_BVH.h.

Constructor & Destructor Documentation

template<uint N>
SYS_FORCE_INLINE UT::BVH< N >::BVH ( )
inlinenoexcept

Definition at line 405 of file UT_BVH.h.

Member Function Documentation

template<uint N>
SYS_FORCE_INLINE void UT::BVH< N >::clear ( void  )
inlinenoexcept

Definition at line 431 of file UT_BVH.h.

template<uint N>
template<typename SRC_INT_TYPE >
void UT::BVH< N >::createTrivialIndices ( SRC_INT_TYPE *  indices,
const INT_TYPE  n 
)
staticnoexcept

Definition at line 642 of file UT_BVHImpl.h.

template<uint N>
void UT::BVH< N >::debugDump ( ) const

Prints a text representation of the tree to stdout.

template<uint N>
int UT::BVH< N >::getMaxDepth ( ) const
noexcept

Returns the maximum depth of any leaf.

Definition at line 362 of file UT_BVHImpl.h.

template<uint N>
SYS_FORCE_INLINE const Node* UT::BVH< N >::getNodes ( ) const
inlinenoexcept

Definition at line 419 of file UT_BVH.h.

template<uint N>
SYS_FORCE_INLINE INT_TYPE UT::BVH< N >::getNumNodes ( ) const
inlinenoexcept

Definition at line 414 of file UT_BVH.h.

template<uint N>
int UT::BVH< N >::getPureInternalDepth ( ) const
noexcept

Returns the minimum depth of the first non-internal node.

Definition at line 418 of file UT_BVHImpl.h.

template<uint N>
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE >
void UT::BVH< N >::init ( const BOX_TYPE *  boxes,
const INT_TYPE  nboxes,
SRC_INT_TYPE *  indices = nullptr,
bool  reorder_indices = false,
INT_TYPE  max_items_per_leaf = 1 
)
noexcept

Definition at line 274 of file UT_BVHImpl.h.

template<uint N>
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE >
void UT::BVH< N >::init ( Box< T, NAXES >  axes_minmax,
const BOX_TYPE *  boxes,
INT_TYPE  nboxes,
SRC_INT_TYPE *  indices = nullptr,
bool  reorder_indices = false,
INT_TYPE  max_items_per_leaf = 1 
)
noexcept

Definition at line 283 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void UT::BVH< N >::traverse ( FUNCTORS &  functors,
LOCAL_DATA *  data_for_parent = nullptr 
) const
noexcept

For each node, this effectively does: LOCAL_DATA local_data[MAX_ORDER]; bool descend = functors.pre(nodei, parent_data); if (!descend) return; for each child { if (isitem(child)) functors.item(getitemi(child), nodei, local_data[child]); else if (isnode(child)) recurse(getnodei(child), local_data); } functors.post(nodei, parent_nodei, data_for_parent, num_children, local_data);

Definition at line 428 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void UT::BVH< N >::traverseParallel ( INT_TYPE  parallel_threshold,
FUNCTORS &  functors,
LOCAL_DATA *  data_for_parent = nullptr 
) const
noexcept

This acts like the traverse function, except if the number of nodes in two subtrees of a node contain at least parallel_threshold nodes, they may be executed in parallel. If parallel_threshold is 0, even item_functor may be executed on items in parallel. NOTE: Make sure that your functors don't depend on the order that they're executed in, e.g. don't add values from sibling nodes together except in post functor, else they might have nondeterministic roundoff or miss some values entirely.

Definition at line 471 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void UT::BVH< N >::traverseVector ( FUNCTORS &  functors,
LOCAL_DATA *  data_for_parent = nullptr 
) const
noexcept

For each node, this effectively does: LOCAL_DATA local_data[MAX_ORDER]; uint descend = functors.pre(nodei, parent_data); if (!descend) return; for each child { if (!(descend & (1<<child))) continue; if (isitem(child)) functors.item(getitemi(child), nodei, local_data[child]); else if (isnode(child)) recurse(getnodei(child), local_data); } functors.post(nodei, parent_nodei, data_for_parent, num_children, local_data);

Definition at line 596 of file UT_BVHImpl.h.


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