|
| BVH () |
| Default constructor. More...
|
|
template<typename BoxIndexable > |
int | initialize (const BoxIndexable boxes, IndexType numItems) |
| Initializes a BVH instance, of specified dimension, over a given set of geometric entities, each represented by its corresponding axis-aligned bounding box. More...
|
|
bool | isInitialized () const |
|
void | setAllocatorID (int allocatorID) |
| Sets the ID of the allocator used by the BVH. More...
|
|
int | getAllocatorID () const |
| Get the ID of the allocator used by the BVH. More...
|
|
void | setScaleFactor (FloatType scale_factor) |
| Sets the scale factor for scaling the supplied bounding boxes. More...
|
|
FloatType | getScaleFactor () const |
| Returns the scale factor used when constructing the BVH. More...
|
|
void | setTolerance (FloatType EPS) |
| Sets the tolerance used for querying the BVH. More...
|
|
FloatType | getTolerance () const |
| Returns the tolerance value used for BVH queries. More...
|
|
BoxType | getBounds () const |
| Returns the bounds of the BVH, given by the the root bounding box. More...
|
|
TraverserType | getTraverser () const |
| Returns a device-copyable object that can be used to traverse the BVH from inside a device kernel. More...
|
|
template<typename PointIndexable > |
void | findPoints (IndexType *offsets, IndexType *counts, IndexType *&candidates, IndexType numPts, PointIndexable points) const |
| Finds the candidate bins that contain each of the query points. More...
|
|
template<typename RayIndexable > |
void | findRays (IndexType *offsets, IndexType *counts, IndexType *&candidates, IndexType numRays, RayIndexable rays) const |
| Finds the candidate bins that intersect the given rays. More...
|
|
template<typename BoxIndexable > |
void | findBoundingBoxes (IndexType *offsets, IndexType *counts, IndexType *&candidates, IndexType numBoxes, BoxIndexable boxes) const |
| Finds the candidate bins that intersect the given bounding boxes. More...
|
|
void | writeVtkFile (const std::string &fileName) const |
| Writes the BVH to the specified VTK file for visualization. More...
|
|
template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC, typename FloatType = double, BVHType BVHImpl = BVHType::LinearBVH>
class axom::spin::BVH< NDIMS, ExecSpace, FloatType, BVHImpl >
Defines a Bounding Volume Hierarchy (BVH) spatial acceleration data structure over a set of geometric entities.
The BVH class provides functionality for generating a hierarchical spatial partitioning over a set of geometric entities. Each entity in the BVH is represented by a bounding volume, in this case an axis-aligned bounding box. Once the BVH structure is generated, it is used to accelerate various spatial queries, such as, collision detection, ray tracing, etc., by reducing the search space for a given operation to an abbreviated list of candidate geometric entities to check for a particular query.
- Template Parameters
-
NDIMS | the number of dimensions, e.g., 2 or 3. |
ExecSpace | the execution space to use, e.g. SEQ_EXEC, CUDA_EXEC, etc. |
FloatType | floating precision, e.g., double or float . Optional. |
- Note
- The last template parameter is optional. Defaults to double precision if not specified.
- Precondition
- The spin::BVH class requires RAJA and Umpire with CUDA_EXEC.
- Note
- The Execution Space, supplied as the 2nd template argument, specifies
- Where and how the BVH is generated and stored
- Where and how subsequent queries are performed
- The default memory space, bound to the corresponding execution space
- See also
- axom::execution_space for more details.
A simple example illustrating how to use the BVH class is given below:
constexpr int DIMENSION = 3;
const double* aabbs = ...
spin::BVH< DIMENSION, axom::OMP_EXEC > bvh;
bvh.initialize( aabbs, numItems );
const double* qx = ...
const double* qy = ...
const double* qz = ...
axom::IndexType* offsets = axom::allocate< IndexType >( numPoints );
bvh.findPoints( offsets, counts, candidates, numPoints, qx, qy, qz );
...
axom::deallocate( candidates );
template<int NDIMS, typename ExecSpace , typename FloatType , BVHType Impl>
template<typename BoxIndexable >