Bounding Volume Hierarchy (BVH) in 2D. More...
#include <Core/Geometry/BVH2.h>
Public Types | |
using | ContainerType = std::vector< T > |
using | Iterator = typename ContainerType::iterator |
using | ConstIterator = typename ContainerType::const_iterator |
Public Member Functions | |
BVH2 () | |
Default constructor. More... | |
void | Build (const std::vector< T > &items, const std::vector< BoundingBox2D > &itemsBounds) |
Builds bounding volume hierarchy. More... | |
void | Clear () |
Clears all the contents of this instance. More... | |
NearestNeighborQueryResult2< T > | GetNearestNeighbor (const Vector2D &pt, const NearestNeighborDistanceFunc2< T > &distanceFunc) const override |
bool | IsIntersects (const BoundingBox2D &box, const BoxIntersectionTestFunc2< T > &testFunc) const override |
Returns true if given box intersects with any of the stored items. More... | |
bool | IsIntersects (const Ray2D &ray, const RayIntersectionTestFunc2< T > &testFunc) const override |
Returns true if given ray intersects with any of the stored items. More... | |
void | ForEachIntersectingItem (const BoundingBox2D &box, const BoxIntersectionTestFunc2< T > &testFunc, const IntersectionVisitorFunc2< T > &visitorFunc) const override |
Invokes visitorFunc for every intersecting items. More... | |
void | ForEachIntersectingItem (const Ray2D &ray, const RayIntersectionTestFunc2< T > &testFunc, const IntersectionVisitorFunc2< T > &visitorFunc) const override |
Invokes visitorFunc for every intersecting items. More... | |
ClosestIntersectionQueryResult2< T > | GetClosestIntersection (const Ray2D &ray, const GetRayIntersectionFunc2< T > &testFunc) const override |
Returns the closest intersection for given ray . More... | |
const BoundingBox2D & | GetBoundingBox () 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::BVH2< T >
Bounding Volume Hierarchy (BVH) in 2D.
This class implements the classic bounding volume hierarchy structure in 2D. It implements IntersectionQueryEngine2 in order to support box/ray intersection tests. Also, NearestNeighborQueryEngine2 is implemented to provide nearest neighbor query.
Member Typedef Documentation
◆ ConstIterator
using CubbyFlow::BVH2< T >::ConstIterator = typename ContainerType::const_iterator |
◆ ContainerType
using CubbyFlow::BVH2< T >::ContainerType = std::vector<T> |
◆ Iterator
using CubbyFlow::BVH2< T >::Iterator = typename ContainerType::iterator |
Constructor & Destructor Documentation
◆ BVH2()
CubbyFlow::BVH2< T >::BVH2 | ( | ) |
Default constructor.
Member Function Documentation
◆ begin() [1/2]
BVH2< T >::Iterator CubbyFlow::BVH2< T >::begin | ( | ) |
Returns the begin iterator of the item.
◆ begin() [2/2]
BVH2< T >::ConstIterator CubbyFlow::BVH2< T >::begin | ( | ) | const |
Returns the immutable begin iterator of the item.
◆ Build()
void CubbyFlow::BVH2< T >::Build | ( | const std::vector< T > & | items, |
const std::vector< BoundingBox2D > & | itemsBounds | ||
) |
Builds bounding volume hierarchy.
◆ Clear()
void CubbyFlow::BVH2< T >::Clear | ( | ) |
Clears all the contents of this instance.
◆ end() [1/2]
BVH2< T >::Iterator CubbyFlow::BVH2< T >::end | ( | ) |
Returns the end iterator of the item.
◆ end() [2/2]
BVH2< T >::ConstIterator CubbyFlow::BVH2< T >::end | ( | ) | const |
Returns the immutable end iterator of the item.
◆ ForEachIntersectingItem() [1/2]
|
inlineoverridevirtual |
Invokes visitorFunc
for every intersecting items.
Implements CubbyFlow::IntersectionQueryEngine2< T >.
◆ ForEachIntersectingItem() [2/2]
|
inlineoverridevirtual |
Invokes visitorFunc
for every intersecting items.
Implements CubbyFlow::IntersectionQueryEngine2< T >.
◆ GetBoundingBox()
const BoundingBox2D & CubbyFlow::BVH2< T >::GetBoundingBox | ( | ) | const |
Returns bounding box of every items.
◆ GetClosestIntersection()
|
inlineoverridevirtual |
Returns the closest intersection for given ray
.
Implements CubbyFlow::IntersectionQueryEngine2< T >.
◆ GetItem()
const T & CubbyFlow::BVH2< T >::GetItem | ( | size_t | i | ) | const |
Returns the item at i
.
◆ GetNearestNeighbor()
|
inlineoverridevirtual |
Returns the nearest neighbor for given point and distance measure function.
Implements CubbyFlow::NearestNeighborQueryEngine2< T >.
◆ GetNumberOfItems()
size_t CubbyFlow::BVH2< T >::GetNumberOfItems | ( | ) | const |
Returns the number of items.
◆ IsIntersects() [1/2]
|
inlineoverridevirtual |
Returns true if given box
intersects with any of the stored items.
Implements CubbyFlow::IntersectionQueryEngine2< T >.
◆ IsIntersects() [2/2]
|
inlineoverridevirtual |
Returns true if given ray
intersects with any of the stored items.
Implements CubbyFlow::IntersectionQueryEngine2< T >.
The documentation for this class was generated from the following files:
- Core/Geometry/BVH2.h
- Core/Geometry/BVH2-Impl.h