Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
split_heuristic.h
Go to the documentation of this file.
1#ifndef BVH_V2_SPLIT_HEURISTIC_H
2#define BVH_V2_SPLIT_HEURISTIC_H
3
4#include "bvh/v2/bbox.h"
5#include "bvh/v2/utils.h"
6
7#include <cstddef>
8
9namespace bvh::v2 {
10
11template <typename T>
13public:
14 /// Creates an SAH evaluator object, used by top-down builders to determine where to split.
15 /// The two parameters are the log of the size of primitive clusters in base 2, and the ratio of
16 /// the cost of intersecting a node (a ray-box intersection) over the cost of intersecting a
17 /// primitive.
25
26 BVH_ALWAYS_INLINE size_t get_prim_count(size_t size) const {
28 }
29
30 template <size_t N>
31 BVH_ALWAYS_INLINE T get_leaf_cost(size_t begin, size_t end, const BBox<T, N>& bbox) const {
32 return bbox.get_half_area() * static_cast<T>(get_prim_count(end - begin));
33 }
34
35 template <size_t N>
36 BVH_ALWAYS_INLINE T get_non_split_cost(size_t begin, size_t end, const BBox<T, N>& bbox) const {
37 return bbox.get_half_area() * (static_cast<T>(get_prim_count(end - begin)) - cost_ratio_);
38 }
39
40private:
44};
45
46} // namespace bvh::v2
47
48#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
BVH_ALWAYS_INLINE size_t get_prim_count(size_t size) const
BVH_ALWAYS_INLINE SplitHeuristic(size_t log_cluster_size=0, T cost_ratio=static_cast< T >(1.))
Creates an SAH evaluator object, used by top-down builders to determine where to split.
BVH_ALWAYS_INLINE T get_leaf_cost(size_t begin, size_t end, const BBox< T, N > &bbox) const
BVH_ALWAYS_INLINE T get_non_split_cost(size_t begin, size_t end, const BBox< T, N > &bbox) const
Definition bbox.h:9
BVH_ALWAYS_INLINE constexpr T make_bitmask(size_t bits)
Generates a bitmask with the given number of bits.
Definition utils.h:35
#define BVH_ALWAYS_INLINE
Definition platform.h:19