Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
bvh::v2::Node< T, Dim, IndexBits, PrimCountBits > Struct Template Reference

template<typename T, size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
struct bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >

Binary BVH node, containing its bounds and an index into its children or the primitives it contains.

By definition, inner BVH nodes do not contain primitives; only leaves do.

Definition at line 23 of file node.h.

Public Types

using Index = bvh::v2::Index< IndexBits, PrimCountBits >
 
using Scalar = T
 

Public Member Functions

 Node ()=default
 
BVH_ALWAYS_INLINE BBox< T, Dim > get_bbox () const
 
BVH_ALWAYS_INLINE Vec< T, Dim > get_max_bounds (const Octant &octant) const
 
BVH_ALWAYS_INLINE Vec< T, Dim > get_min_bounds (const Octant &octant) const
 
BVH_ALWAYS_INLINE std::pair< T, T > intersect_fast (const Ray< T, Dim > &ray, const Vec< T, Dim > &inv_dir, const Vec< T, Dim > &inv_org, const Octant &octant) const
 
BVH_ALWAYS_INLINE std::pair< T, T > intersect_robust (const Ray< T, Dim > &ray, const Vec< T, Dim > &inv_dir, const Vec< T, Dim > &inv_dir_pad, const Octant &octant) const
 Robust ray-node intersection routine. See "Robust BVH Ray Traversal", by T. Ize.
 
BVH_ALWAYS_INLINE bool is_leaf () const
 
bool operator!= (const Node &other) const
 
bool operator== (const Node &other) const
 
BVH_ALWAYS_INLINE void serialize (OutputStream &stream) const
 
BVH_ALWAYS_INLINE void set_bbox (const BBox< T, Dim > &bbox)
 

Static Public Member Functions

static BVH_ALWAYS_INLINE Node deserialize (InputStream &stream)
 

Public Attributes

std::array< T, Dim *2 > bounds
 Bounds of the node, laid out in memory as [min_x, max_x, min_y, max_y, ...].
 
Index index
 Index to the children of an inner node, or to the primitives for a leaf node.
 

Static Public Attributes

static constexpr size_t dimension = Dim
 
static constexpr size_t index_bits = IndexBits
 
static constexpr size_t prim_count_bits = PrimCountBits
 

Static Private Member Functions

static BVH_ALWAYS_INLINE std::pair< T, T > make_intersection_result (const Ray< T, Dim > &ray, const Vec< T, Dim > &tmin, const Vec< T, Dim > &tmax)
 

#include <bvh/v2/node.h>

Member Typedef Documentation

◆ Index

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
using bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::Index = bvh::v2::Index<IndexBits, PrimCountBits>

Definition at line 25 of file node.h.

◆ Scalar

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
using bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::Scalar = T

Definition at line 24 of file node.h.

Constructor & Destructor Documentation

◆ Node()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::Node ( )
default

Member Function Documentation

◆ deserialize()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
static BVH_ALWAYS_INLINE Node bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::deserialize ( InputStream stream)
inlinestatic

Definition at line 102 of file node.h.

◆ get_bbox()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE BBox< T, Dim > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::get_bbox ( ) const
inline

Definition at line 52 of file node.h.

◆ get_max_bounds()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE Vec< T, Dim > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::get_max_bounds ( const Octant octant) const
inline

Definition at line 69 of file node.h.

◆ get_min_bounds()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE Vec< T, Dim > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::get_min_bounds ( const Octant octant) const
inline

Definition at line 65 of file node.h.

◆ intersect_fast()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE std::pair< T, T > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::intersect_fast ( const Ray< T, Dim > &  ray,
const Vec< T, Dim > &  inv_dir,
const Vec< T, Dim > &  inv_org,
const Octant octant 
) const
inline

Definition at line 85 of file node.h.

◆ intersect_robust()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE std::pair< T, T > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::intersect_robust ( const Ray< T, Dim > &  ray,
const Vec< T, Dim > &  inv_dir,
const Vec< T, Dim > &  inv_dir_pad,
const Octant octant 
) const
inline

Robust ray-node intersection routine. See "Robust BVH Ray Traversal", by T. Ize.

Definition at line 74 of file node.h.

◆ is_leaf()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE bool bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::is_leaf ( ) const
inline

Definition at line 50 of file node.h.

◆ make_intersection_result()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
static BVH_ALWAYS_INLINE std::pair< T, T > bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::make_intersection_result ( const Ray< T, Dim > &  ray,
const Vec< T, Dim > &  tmin,
const Vec< T, Dim > &  tmax 
)
inlinestaticprivate

Definition at line 111 of file node.h.

◆ operator!=()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
bool bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::operator!= ( const Node< T, Dim, IndexBits, PrimCountBits > &  other) const
inline

Definition at line 43 of file node.h.

◆ operator==()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
bool bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::operator== ( const Node< T, Dim, IndexBits, PrimCountBits > &  other) const
inline

Definition at line 46 of file node.h.

◆ serialize()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE void bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::serialize ( OutputStream stream) const
inline

Definition at line 96 of file node.h.

◆ set_bbox()

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
BVH_ALWAYS_INLINE void bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::set_bbox ( const BBox< T, Dim > &  bbox)
inline

Definition at line 58 of file node.h.

Member Data Documentation

◆ bounds

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
std::array<T, Dim * 2> bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::bounds

Bounds of the node, laid out in memory as [min_x, max_x, min_y, max_y, ...].

Users should not really depend on a specific order and instead use get_bbox() and extract the min and/or max components accordingly.

Definition at line 34 of file node.h.

◆ dimension

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
constexpr size_t bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::dimension = Dim
staticconstexpr

Definition at line 27 of file node.h.

◆ index

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
Index bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::index

Index to the children of an inner node, or to the primitives for a leaf node.

Definition at line 37 of file node.h.

◆ index_bits

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
constexpr size_t bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::index_bits = IndexBits
staticconstexpr

Definition at line 29 of file node.h.

◆ prim_count_bits

template<typename T , size_t Dim, size_t IndexBits = sizeof(T) * CHAR_BIT, size_t PrimCountBits = 4>
constexpr size_t bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >::prim_count_bits = PrimCountBits
staticconstexpr

Definition at line 28 of file node.h.

Collaboration diagram for bvh::v2::Node< T, Dim, IndexBits, PrimCountBits >:
[legend]

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