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, StoragePolicy >::Node Struct Reference

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

#include <EBGeometry_BVH.hpp>

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

Public Member Functions

void setBoundingVolume (const BV &a_bv) noexcept
 Set the bounding volume for this node.
 
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.
 
const BVgetBoundingVolume () const noexcept
 Get the bounding volume.
 
uint32_t getPrimitivesOffset () const noexcept
 Get the primitive offset (leaf nodes only).
 
uint32_t getNumPrimitives () const noexcept
 Get the primitive count.
 
const std::array< uint32_t, K > & getChildOffsets () const noexcept
 Get the child index table.
 
bool isLeaf () const noexcept
 Return true if this is a leaf node.
 
getDistanceToBoundingVolume (const Vec3T< T > &a_point) const noexcept
 Get the distance from a_point to this node's bounding volume.
 
getDistanceToBoundingVolume2 (const Vec3T< T > &a_point) const noexcept
 Get the squared distance from a_point to this node's bounding volume.
 

Public Attributes

BV m_bv {}
 Axis-aligned bounding box for this node's subtree.
 
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).
 
std::array< uint32_t, K > m_childOff {}
 Depth-first indices of the K child nodes (interior nodes only).
 

Detailed Description

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

Compact BVH node stored in the flat node array.

Each node holds a bounding volume, a primitive range (leaves) or child index table (interior nodes). Exposed as a public nested type so that users can write traverse() callbacks (PrunePredicate, NodeKeyFactory) that inspect nodes.

Member Function Documentation

◆ getBoundingVolume()

template<class T , class P , size_t K, class StoragePolicy >
const BV & EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::getBoundingVolume ( ) const
inlinenoexcept

Get the bounding volume.

Returns
Reference to m_bv.

◆ getChildOffsets()

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

Get the child index table.

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

◆ getDistanceToBoundingVolume()

template<class T , class P , size_t K, class StoragePolicy >
T EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::getDistanceToBoundingVolume ( const Vec3T< T > &  a_point) const
inlinenoexcept

Get the distance from a_point to this node's bounding volume.

Parameters
[in]a_pointQuery point.
Returns
Distance to the bounding-box surface, or zero if inside.

◆ getDistanceToBoundingVolume2()

template<class T , class P , size_t K, class StoragePolicy >
T EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::getDistanceToBoundingVolume2 ( const Vec3T< T > &  a_point) const
inlinenoexcept

Get the squared distance from a_point to this node's bounding volume.

Avoids the sqrt that getDistanceToBoundingVolume() pays. pruneTraverse()'s scalar-fallback branch-and-bound compares against a squared pruning bound, so it uses this directly rather than taking a square root only to square it again.

Parameters
[in]a_pointQuery point.
Returns
Squared distance to the bounding-box surface, or zero if inside.

◆ getNumPrimitives()

template<class T , class P , size_t K, class StoragePolicy >
uint32_t EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::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, class StoragePolicy >
uint32_t EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::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, class StoragePolicy >
bool EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::isLeaf ( ) const
inlinenoexcept

Return true if this is a leaf node.

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

◆ setBoundingVolume()

template<class T , class P , size_t K, class StoragePolicy >
void EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::setBoundingVolume ( const BV a_bv)
inlinenoexcept

Set the bounding volume for this node.

Parameters
[in]a_bvBounding volume.

◆ setChildOffset()

template<class T , class P , size_t K, class StoragePolicy >
void EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::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, class StoragePolicy >
void EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::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, class StoragePolicy >
void EBGeometry::BVH::PackedBVH< T, P, K, StoragePolicy >::Node::setPrimitivesOffset ( uint32_t  a_off)
inlinenoexcept

Set the primitive offset for this leaf node.

Parameters
[in]a_offIndex into the global primitive list.

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