CubbyFlow::BVH3< T > Class Template Referencefinal

Bounding Volume Hierarchy (BVH) in 3D. More...

#include <Core/Geometry/BVH3.h>

Inheritance diagram for CubbyFlow::BVH3< T >:
CubbyFlow::IntersectionQueryEngine3< T > CubbyFlow::NearestNeighborQueryEngine3< T >

Public Types

using ContainerType = std::vector< T >
 
using Iterator = typename ContainerType::iterator
 
using ConstIterator = typename ContainerType::const_iterator
 

Public Member Functions

 BVH3 ()
 Default constructor. More...
 
void Build (const std::vector< T > &items, const std::vector< BoundingBox3D > &itemsBounds)
 Builds bounding volume hierarchy. More...
 
void Clear ()
 Clears all the contents of this instance. More...
 
NearestNeighborQueryResult3< T > GetNearestNeighbor (const Vector3D &pt, const NearestNeighborDistanceFunc3< T > &distanceFunc) const override
 
bool IsIntersects (const BoundingBox3D &box, const BoxIntersectionTestFunc3< T > &testFunc) const override
 Returns true if given box intersects with any of the stored items. More...
 
bool IsIntersects (const Ray3D &ray, const RayIntersectionTestFunc3< T > &testFunc) const override
 Returns true if given ray intersects with any of the stored items. More...
 
void ForEachIntersectingItem (const BoundingBox3D &box, const BoxIntersectionTestFunc3< T > &testFunc, const IntersectionVisitorFunc3< T > &visitorFunc) const override
 Invokes visitorFunc for every intersecting items. More...
 
void ForEachIntersectingItem (const Ray3D &ray, const RayIntersectionTestFunc3< T > &testFunc, const IntersectionVisitorFunc3< T > &visitorFunc) const override
 Invokes visitorFunc for every intersecting items. More...
 
ClosestIntersectionQueryResult3< T > GetClosestIntersection (const Ray3D &ray, const GetRayIntersectionFunc3< T > &testFunc) const override
 Returns the closest intersection for given ray. More...
 
const BoundingBox3DGetBoundingBox () const
 Returns bounding box of every items. More...
 
Iterator begin ()
 Returns the begin iterator of the item. More...
 
Iterator end ()
 Returns the end iterator of the item. More...
 
ConstIterator begin () const
 Returns the immutable begin iterator of the item. More...
 
ConstIterator end () const
 Returns the immutable end iterator of the item. More...
 
size_t GetNumberOfItems () const
 Returns the number of items. More...
 
const T & GetItem (size_t i) const
 Returns the item at i. More...
 

Detailed Description

template<typename T>
class CubbyFlow::BVH3< T >

Bounding Volume Hierarchy (BVH) in 3D.

This class implements the classic bounding volume hierarchy structure in 3D. It implements IntersectionQueryEngine3 in order to support box/ray intersection tests. Also, NearestNeighborQueryEngine3 is implemented to provide nearest neighbor query.

Member Typedef Documentation

◆ ConstIterator

template<typename T>
using CubbyFlow::BVH3< T >::ConstIterator = typename ContainerType::const_iterator

◆ ContainerType

template<typename T>
using CubbyFlow::BVH3< T >::ContainerType = std::vector<T>

◆ Iterator

template<typename T>
using CubbyFlow::BVH3< T >::Iterator = typename ContainerType::iterator

Constructor & Destructor Documentation

◆ BVH3()

template<typename T >
CubbyFlow::BVH3< T >::BVH3 ( )

Default constructor.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
BVH3< T >::Iterator CubbyFlow::BVH3< T >::begin ( )

Returns the begin iterator of the item.

◆ begin() [2/2]

template<typename T >
BVH3< T >::ConstIterator CubbyFlow::BVH3< T >::begin ( ) const

Returns the immutable begin iterator of the item.

◆ Build()

template<typename T>
void CubbyFlow::BVH3< T >::Build ( const std::vector< T > &  items,
const std::vector< BoundingBox3D > &  itemsBounds 
)

Builds bounding volume hierarchy.

◆ Clear()

template<typename T >
void CubbyFlow::BVH3< T >::Clear ( )

Clears all the contents of this instance.

◆ end() [1/2]

template<typename T >
BVH3< T >::Iterator CubbyFlow::BVH3< T >::end ( )

Returns the end iterator of the item.

◆ end() [2/2]

template<typename T >
BVH3< T >::ConstIterator CubbyFlow::BVH3< T >::end ( ) const

Returns the immutable end iterator of the item.

◆ ForEachIntersectingItem() [1/2]

template<typename T>
void CubbyFlow::BVH3< T >::ForEachIntersectingItem ( const BoundingBox3D box,
const BoxIntersectionTestFunc3< T > &  testFunc,
const IntersectionVisitorFunc3< T > &  visitorFunc 
) const
inlineoverridevirtual

Invokes visitorFunc for every intersecting items.

Implements CubbyFlow::IntersectionQueryEngine3< T >.

◆ ForEachIntersectingItem() [2/2]

template<typename T>
void CubbyFlow::BVH3< T >::ForEachIntersectingItem ( const Ray3D ray,
const RayIntersectionTestFunc3< T > &  testFunc,
const IntersectionVisitorFunc3< T > &  visitorFunc 
) const
inlineoverridevirtual

Invokes visitorFunc for every intersecting items.

Implements CubbyFlow::IntersectionQueryEngine3< T >.

◆ GetBoundingBox()

template<typename T >
const BoundingBox3D & CubbyFlow::BVH3< T >::GetBoundingBox ( ) const

Returns bounding box of every items.

◆ GetClosestIntersection()

template<typename T>
ClosestIntersectionQueryResult3< T > CubbyFlow::BVH3< T >::GetClosestIntersection ( const Ray3D ray,
const GetRayIntersectionFunc3< T > &  testFunc 
) const
inlineoverridevirtual

Returns the closest intersection for given ray.

Implements CubbyFlow::IntersectionQueryEngine3< T >.

◆ GetItem()

template<typename T >
const T & CubbyFlow::BVH3< T >::GetItem ( size_t  i) const

Returns the item at i.

◆ GetNearestNeighbor()

template<typename T>
NearestNeighborQueryResult3< T > CubbyFlow::BVH3< T >::GetNearestNeighbor ( const Vector3D pt,
const NearestNeighborDistanceFunc3< T > &  distanceFunc 
) const
inlineoverridevirtual

Returns the nearest neighbor for given point and distance measure function.

Implements CubbyFlow::NearestNeighborQueryEngine3< T >.

◆ GetNumberOfItems()

template<typename T >
size_t CubbyFlow::BVH3< T >::GetNumberOfItems ( ) const

Returns the number of items.

◆ IsIntersects() [1/2]

template<typename T>
bool CubbyFlow::BVH3< T >::IsIntersects ( const BoundingBox3D box,
const BoxIntersectionTestFunc3< T > &  testFunc 
) const
inlineoverridevirtual

Returns true if given box intersects with any of the stored items.

Implements CubbyFlow::IntersectionQueryEngine3< T >.

◆ IsIntersects() [2/2]

template<typename T>
bool CubbyFlow::BVH3< T >::IsIntersects ( const Ray3D ray,
const RayIntersectionTestFunc3< T > &  testFunc 
) const
inlineoverridevirtual

Returns true if given ray intersects with any of the stored items.

Implements CubbyFlow::IntersectionQueryEngine3< T >.


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