HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HDK_Sample::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
 
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 HDK_Sample::UT::BVH< N >

Definition at line 377 of file UT_BVH.h.

Member Typedef Documentation

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

Definition at line 379 of file UT_BVH.h.

Constructor & Destructor Documentation

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

Definition at line 410 of file UT_BVH.h.

Member Function Documentation

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

Definition at line 430 of file UT_BVH.h.

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

Definition at line 562 of file UT_BVHImpl.h.

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

Prints a text representation of the tree to stdout.

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

Definition at line 424 of file UT_BVH.h.

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

Definition at line 419 of file UT_BVH.h.

template<uint N>
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE >
void HDK_Sample::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 292 of file UT_BVHImpl.h.

template<uint N>
template<BVH_Heuristic H, typename T , uint NAXES, typename BOX_TYPE , typename SRC_INT_TYPE >
void HDK_Sample::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 301 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void HDK_Sample::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 349 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void HDK_Sample::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 392 of file UT_BVHImpl.h.

template<uint N>
template<typename LOCAL_DATA , typename FUNCTORS >
void HDK_Sample::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 516 of file UT_BVHImpl.h.


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