Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
bvh::v2::BinnedSahBuilder< Node, BinCount > Class Template Reference

template<typename Node, size_t BinCount = 8>
class bvh::v2::BinnedSahBuilder< Node, BinCount >

Single-threaded top-down builder that partitions primitives based on a binned approximation of the Surface Area Heuristic (SAH).

This builder is inspired by "On Fast Construction of SAH-based Bounding Volume Hierarchies", by I. Wald.

Definition at line 19 of file binned_sah_builder.h.

Classes

struct  Bin
 
struct  Split
 

Static Public Member Functions

static BVH_ALWAYS_INLINE Bvh< Nodebuild (std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config={})
 

Protected Types

using Bins = std::array<Bin, BinCount>
 
using PerAxisBins = std::array<Bins, Node::dimension>
 
- Protected Types inherited from bvh::v2::TopDownSahBuilder< Node >
using BBox = bvh::v2::BBox<Scalar, Node::dimension>
 
using Scalar = typename Node::Scalar
 
using Vec = bvh::v2::Vec<Scalar, Node::dimension>
 

Protected Member Functions

BVH_ALWAYS_INLINE BinnedSahBuilder (std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config)
 
size_t fallback_split (size_t axis, size_t begin, size_t end)
 
BVH_ALWAYS_INLINE void fill_bins (PerAxisBins &per_axis_bins, const BBox &bbox, size_t begin, size_t end)
 
void find_best_split (size_t axis, const Bins &bins, Split &best_split)
 
std::vector< size_t > & get_prim_ids () override
 
std::optional< size_t > try_split (const BBox &bbox, size_t begin, size_t end) override
 
- Protected Member Functions inherited from bvh::v2::TopDownSahBuilder< Node >
BVH_ALWAYS_INLINE TopDownSahBuilder (std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config)
 
Bvh< Nodebuild ()
 
BVH_ALWAYS_INLINE BBox compute_bbox (size_t begin, size_t end) const
 
BVH_ALWAYS_INLINE const std::vector< size_t > & get_prim_ids () const
 

Protected Attributes

std::vector< size_t > prim_ids_
 
- Protected Attributes inherited from bvh::v2::TopDownSahBuilder< Node >
std::span< const BBoxbboxes_
 
std::span< const Veccenters_
 
const Configconfig_
 

#include <bvh/v2/binned_sah_builder.h>

Inheritance diagram for bvh::v2::BinnedSahBuilder< Node, BinCount >:
[legend]

Member Typedef Documentation

◆ Bins

template<typename Node , size_t BinCount = 8>
using bvh::v2::BinnedSahBuilder< Node, BinCount >::Bins = std::array<Bin, BinCount>
protected

Definition at line 65 of file binned_sah_builder.h.

◆ PerAxisBins

template<typename Node , size_t BinCount = 8>
using bvh::v2::BinnedSahBuilder< Node, BinCount >::PerAxisBins = std::array<Bins, Node::dimension>
protected

Definition at line 66 of file binned_sah_builder.h.

Constructor & Destructor Documentation

◆ BinnedSahBuilder()

template<typename Node , size_t BinCount = 8>
BVH_ALWAYS_INLINE bvh::v2::BinnedSahBuilder< Node, BinCount >::BinnedSahBuilder ( std::span< const BBox > bboxes,
std::span< const Vec > centers,
const Config & config )
inlineprotected

Definition at line 70 of file binned_sah_builder.h.

Member Function Documentation

◆ build()

template<typename Node , size_t BinCount = 8>
static BVH_ALWAYS_INLINE Bvh< Node > bvh::v2::BinnedSahBuilder< Node, BinCount >::build ( std::span< const BBox > bboxes,
std::span< const Vec > centers,
const Config & config = {} )
inlinestatic

Definition at line 32 of file binned_sah_builder.h.

◆ fallback_split()

template<typename Node , size_t BinCount = 8>
size_t bvh::v2::BinnedSahBuilder< Node, BinCount >::fallback_split ( size_t axis,
size_t begin,
size_t end )
inlineprotected

Definition at line 118 of file binned_sah_builder.h.

◆ fill_bins()

template<typename Node , size_t BinCount = 8>
BVH_ALWAYS_INLINE void bvh::v2::BinnedSahBuilder< Node, BinCount >::fill_bins ( PerAxisBins & per_axis_bins,
const BBox & bbox,
size_t begin,
size_t end )
inlineprotected

Definition at line 82 of file binned_sah_builder.h.

◆ find_best_split()

template<typename Node , size_t BinCount = 8>
void bvh::v2::BinnedSahBuilder< Node, BinCount >::find_best_split ( size_t axis,
const Bins & bins,
Split & best_split )
inlineprotected

Definition at line 101 of file binned_sah_builder.h.

◆ get_prim_ids()

template<typename Node , size_t BinCount = 8>
std::vector< size_t > & bvh::v2::BinnedSahBuilder< Node, BinCount >::get_prim_ids ( )
inlineoverrideprotectedvirtual

Implements bvh::v2::TopDownSahBuilder< Node >.

Definition at line 80 of file binned_sah_builder.h.

◆ try_split()

template<typename Node , size_t BinCount = 8>
std::optional< size_t > bvh::v2::BinnedSahBuilder< Node, BinCount >::try_split ( const BBox & bbox,
size_t begin,
size_t end )
inlineoverrideprotectedvirtual

Implements bvh::v2::TopDownSahBuilder< Node >.

Definition at line 128 of file binned_sah_builder.h.

Member Data Documentation

◆ prim_ids_

template<typename Node , size_t BinCount = 8>
std::vector<size_t> bvh::v2::BinnedSahBuilder< Node, BinCount >::prim_ids_
protected

Definition at line 68 of file binned_sah_builder.h.

  • geom/geom/inc/bvh/v2/binned_sah_builder.h