PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::gpu::geometry::Bvh Class Reference

GPU linear BVH [6] public API. More...

#include <Bvh.h>

Public Types

using MortonCodeType = pbat::geometry::MortonCodeType
 Type of the Morton codes.
 

Public Member Functions

PBAT_API Bvh (GpuIndex nBoxes, GpuIndex nOverlaps)
 Construct a new Bvh object with space allocated for nBoxes and at most nOverlaps.
 
 Bvh (Bvh const &)=delete
 
Bvhoperator= (Bvh const &)=delete
 
PBAT_API Bvh (Bvh &&other) noexcept
 Move constructor.
 
PBAT_API Bvhoperator= (Bvh &&other) noexcept
 Move assignment.
 
PBAT_API void Build (Aabb &aabbs, Eigen::Vector< GpuScalar, 3 > const &min, Eigen::Vector< GpuScalar, 3 > const &max)
 Build the BVH from the given AABBs.
 
PBAT_API GpuIndexMatrixX DetectOverlaps (Aabb const &aabbs)
 Detect overlaps between the AABBs.
 
PBAT_API GpuIndexMatrixX DetectOverlaps (common::Buffer const &set, Aabb const &aabbs)
 Detect overlaps between the AABBs of different sets.
 
PBAT_API GpuIndexMatrixX PointTriangleNearestNeighbors (Aabb const &aabbs, common::Buffer const &X, common::Buffer const &V, common::Buffer const &F)
 Compute nearest triangles (V,F) to points X, given the triangle AABBs.
 
PBAT_API GpuIndexMatrixX PointTetrahedronNearestNeighbors (Aabb const &aabbs, common::Buffer const &X, common::Buffer const &V, common::Buffer const &T)
 Compute nearest tets (V,T) to points X, given the tetrahedron AABBs.
 
PBAT_API GpuMatrixX Min () const
 BVH nodes' box minimums.
 
PBAT_API GpuMatrixX Max () const
 BVH nodes' box maximums.
 
PBAT_API GpuIndexVectorX LeafOrdering () const
 
PBAT_API Eigen::Vector< MortonCodeType, Eigen::Dynamic > MortonCodes () const
 
PBAT_API GpuIndexMatrixX Child () const
 
PBAT_API GpuIndexVectorX Parent () const
 
PBAT_API GpuIndexMatrixX Rightmost () const
 
PBAT_API GpuIndexVectorX Visits () const
 
PBAT_API impl::geometry::BvhImpl ()
 Handle to the implementation.
 
PBAT_API impl::geometry::Bvh const * Impl () const
 Handle to the implementation.
 
PBAT_API ~Bvh ()
 Destructor.
 

Detailed Description

GPU linear BVH [6] public API.

Constructor & Destructor Documentation

◆ Bvh() [1/2]

pbat::gpu::geometry::Bvh::Bvh ( GpuIndex nBoxes,
GpuIndex nOverlaps )

Construct a new Bvh object with space allocated for nBoxes and at most nOverlaps.

Parameters
nBoxesNumber of boxes
nOverlapsMaximum number of overlaps

◆ Bvh() [2/2]

pbat::gpu::geometry::Bvh::Bvh ( Bvh && other)
noexcept

Move constructor.

Parameters
otherBvh to move from

Member Function Documentation

◆ Build()

void pbat::gpu::geometry::Bvh::Build ( Aabb & aabbs,
Eigen::Vector< GpuScalar, 3 > const & min,
Eigen::Vector< GpuScalar, 3 > const & max )

Build the BVH from the given AABBs.

Parameters
aabbsHandle to the AABBs
minMinimum of the world's bounding box
maxMaximum of the world's bounding box

◆ Child()

GpuIndexMatrixX pbat::gpu::geometry::Bvh::Child ( ) const
Returns

◆ DetectOverlaps() [1/2]

GpuIndexMatrixX pbat::gpu::geometry::Bvh::DetectOverlaps ( Aabb const & aabbs)

Detect overlaps between the AABBs.

Parameters
aabbsThe AABBs which were used to build this BVH

◆ DetectOverlaps() [2/2]

GpuIndexMatrixX pbat::gpu::geometry::Bvh::DetectOverlaps ( common::Buffer const & set,
Aabb const & aabbs )

Detect overlaps between the AABBs of different sets.

Parameters
set|# aabbs| map of indices of aabbs to their corresponding set, i.e. set[i] = j means that aabb i belongs to set j. Must be a 1D Buffer of type GpuIndex of the same size as aabbs.
aabbsThe AABBs which were used to build this BVH
Returns
2x|# Foverlaps| matrix of overlap pairs between boxes of different sets

◆ Impl() [1/2]

impl::geometry::Bvh * pbat::gpu::geometry::Bvh::Impl ( )

Handle to the implementation.

Returns
Handle to the implementation

◆ Impl() [2/2]

impl::geometry::Bvh const * pbat::gpu::geometry::Bvh::Impl ( ) const

Handle to the implementation.

Returns
Handle to the implementation

◆ LeafOrdering()

GpuIndexVectorX pbat::gpu::geometry::Bvh::LeafOrdering ( ) const
Returns

◆ Max()

GpuMatrixX pbat::gpu::geometry::Bvh::Max ( ) const

BVH nodes' box maximums.

Returns
dims x |# aabbs| array of box upper bounds

◆ Min()

GpuMatrixX pbat::gpu::geometry::Bvh::Min ( ) const

BVH nodes' box minimums.

Returns
dims x |# aabbs| array of box lower bounds

◆ MortonCodes()

Eigen::Vector< typename Bvh::MortonCodeType, Eigen::Dynamic > pbat::gpu::geometry::Bvh::MortonCodes ( ) const
Returns

◆ operator=()

Bvh & pbat::gpu::geometry::Bvh::operator= ( Bvh && other)
noexcept

Move assignment.

Parameters
otherBvh to move from
Returns
Reference to this

◆ Parent()

GpuIndexVectorX pbat::gpu::geometry::Bvh::Parent ( ) const
Returns

◆ PointTetrahedronNearestNeighbors()

PBAT_API GpuIndexMatrixX pbat::gpu::geometry::Bvh::PointTetrahedronNearestNeighbors ( Aabb const & aabbs,
common::Buffer const & X,
common::Buffer const & V,
common::Buffer const & T )

Compute nearest tets (V,T) to points X, given the tetrahedron AABBs.

Parameters
aabbsThe AABBs of the tets
X3x|# pts| matrix of NN query points
V3x|# verts| matrix of vertices
T4x|# tets| matrix of tet vertex indices
Returns
|# X| matrix of nearest tets to corresponding columns in X

◆ PointTriangleNearestNeighbors()

PBAT_API GpuIndexMatrixX pbat::gpu::geometry::Bvh::PointTriangleNearestNeighbors ( Aabb const & aabbs,
common::Buffer const & X,
common::Buffer const & V,
common::Buffer const & F )

Compute nearest triangles (V,F) to points X, given the triangle AABBs.

Parameters
aabbsThe AABBs of the triangles
X3x|# pts| matrix of NN query points
V3x|# verts| matrix of vertices
F3x|# triangles| matrix of triangle vertex indices
Returns
|# X| matrix of nearest triangles to corresponding columns in X

◆ Rightmost()

GpuIndexMatrixX pbat::gpu::geometry::Bvh::Rightmost ( ) const
Returns

◆ Visits()

GpuIndexVectorX pbat::gpu::geometry::Bvh::Visits ( ) const
Returns

The documentation for this class was generated from the following files: