EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
EBGeometry::BVH::PackedBVH< T, P, K >::Node Struct Reference

Compact BVH node stored in the flat node array. More...

#include <EBGeometry_PackedBVH.hpp>

Collaboration diagram for EBGeometry::BVH::PackedBVH< T, P, K >::Node:
Collaboration graph
[legend]

Public Member Functions

void setPrimitivesOffset (uint32_t a_off) noexcept
 Set the primitive offset for this leaf node.
 
void setNumPrimitives (uint32_t a_n) noexcept
 Set the primitive count for this leaf node.
 
void setChildOffset (uint32_t a_off, size_t a_k) noexcept
 Set the depth-first index of the k-th child.
 
uint32_t getPrimitivesOffset () const noexcept
 Get the primitive offset (leaf nodes only).
 
uint32_t getNumPrimitives () const noexcept
 Get the primitive count.
 
const Array< uint32_t, K > & getChildOffsets () const noexcept
 Get the child index table.
 
uint32_t getChildBoxRow () const noexcept
 Get the row of this interior node's children's boxes in the SIMD box array.
 
uint32_t getBoxSlot () const noexcept
 Get where this node's own box is stored; see m_boxSlot.
 
bool isLeaf () const noexcept
 Return true if this is a leaf node.
 

Public Attributes

uint32_t m_primOff {}
 Index of the first primitive in the global primitive list (leaf nodes only).
 
uint32_t m_numPrims {}
 Number of primitives in this leaf (zero for interior nodes).
 
Array< uint32_t, K > m_childOff {}
 Depth-first indices of the K child nodes (interior nodes only).
 
uint32_t m_childBoxRow {}
 Row of this interior node's children's boxes in PackedBVH's SIMD box array.
 
uint32_t m_boxSlot {}
 Where this node's own box is stored: row * K + slot in the SIMD box array, the row being its parent's and the slot its position among the parent's children; RootBoxSlot for the root.
 

Detailed Description

template<class T, class P, size_t K>
struct EBGeometry::BVH::PackedBVH< T, P, K >::Node

Compact BVH node stored in the flat node array.

Each node holds a primitive range (leaves) or child index table (interior nodes). It does not hold its own box: every box is stored once, in its parent's row of the SIMD box array (the root's in the BVH itself), and PackedBVH::getBoundingVolume(const Node&) finds it through the node's box slot. Exposed as a public nested type so that users can write traverse() visit callbacks, or their own walks over getNodes(), that inspect nodes. A node is 32 bytes at K = 4, in either precision.

Member Function Documentation

◆ getBoxSlot()

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::getBoxSlot ( ) const
inlinenoexcept

Get where this node's own box is stored; see m_boxSlot.

Returns
row * K + slot, or RootBoxSlot for the root.

◆ getChildBoxRow()

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::getChildBoxRow ( ) const
inlinenoexcept

Get the row of this interior node's children's boxes in the SIMD box array.

Returns
Row index; meaningless for a leaf.

◆ getChildOffsets()

template<class T , class P , size_t K>
const Array< uint32_t, K > & EBGeometry::BVH::PackedBVH< T, P, K >::Node::getChildOffsets ( ) const
inlinenoexcept

Get the child index table.

Returns
Reference to the K-element child-offset array.

◆ getNumPrimitives()

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::getNumPrimitives ( ) const
inlinenoexcept

Get the primitive count.

Returns
Number of primitives; zero for interior nodes.

◆ getPrimitivesOffset()

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::getPrimitivesOffset ( ) const
inlinenoexcept

Get the primitive offset (leaf nodes only).

Returns
Index of the first primitive in the global list.

◆ isLeaf()

template<class T , class P , size_t K>
bool EBGeometry::BVH::PackedBVH< T, P, K >::Node::isLeaf ( ) const
inlinenoexcept

Return true if this is a leaf node.

Returns
True if m_numPrims > 0 (leaf), false otherwise (interior).

◆ setChildOffset()

template<class T , class P , size_t K>
void EBGeometry::BVH::PackedBVH< T, P, K >::Node::setChildOffset ( uint32_t  a_off,
size_t  a_k 
)
inlinenoexcept

Set the depth-first index of the k-th child.

Parameters
[in]a_offNode index of the child.
[in]a_kChild slot (0 … K-1).

◆ setNumPrimitives()

template<class T , class P , size_t K>
void EBGeometry::BVH::PackedBVH< T, P, K >::Node::setNumPrimitives ( uint32_t  a_n)
inlinenoexcept

Set the primitive count for this leaf node.

Parameters
[in]a_nNumber of primitives.

◆ setPrimitivesOffset()

template<class T , class P , size_t K>
void EBGeometry::BVH::PackedBVH< T, P, K >::Node::setPrimitivesOffset ( uint32_t  a_off)
inlinenoexcept

Set the primitive offset for this leaf node.

Parameters
[in]a_offIndex into the global primitive list.

Member Data Documentation

◆ m_boxSlot

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::m_boxSlot {}

Where this node's own box is stored: row * K + slot in the SIMD box array, the row being its parent's and the slot its position among the parent's children; RootBoxSlot for the root.

Owned by PackedBVH, which assigns it with m_childBoxRow.

◆ m_childBoxRow

template<class T , class P , size_t K>
uint32_t EBGeometry::BVH::PackedBVH< T, P, K >::Node::m_childBoxRow {}

Row of this interior node's children's boxes in PackedBVH's SIMD box array.

Owned by PackedBVH, which assigns it when the BVH is built or adopted, overwriting whatever the node array held; leaves have no row. Only interior nodes get a row, so the box array has one row per interior node rather than one per node.


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