|
Jet
v1.3.3
|
Bounding Volume Hierarchy (BVH) in 2D. More...
#include <jet/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 > | nearest (const Vector2D &pt, const NearestNeighborDistanceFunc2< T > &distanceFunc) const override |
| bool | intersects (const BoundingBox2D &box, const BoxIntersectionTestFunc2< T > &testFunc) const override |
Returns true if given box intersects with any of the stored items. More... | |
| bool | intersects (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 > | closestIntersection (const Ray2D &ray, const GetRayIntersectionFunc2< T > &testFunc) const override |
Returns the closest intersection for given ray. More... | |
| const BoundingBox2D & | boundingBox () 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 | numberOfItems () const |
| Returns the number of items. More... | |
| const T & | item (size_t i) const |
Returns the item at i. More... | |
| size_t | numberOfNodes () const |
| Returns the number of nodes. More... | |
| std::pair< size_t, size_t > | children (size_t i) const |
Returns the children indices of i-th node. More... | |
| bool | isLeaf (size_t i) const |
Returns true if i-th node is a leaf node. More... | |
| const BoundingBox2D & | nodeBound (size_t i) const |
Returns bounding box of i-th node. More... | |
| Iterator | itemOfNode (size_t i) |
Returns item of i-th node. More... | |
| ConstIterator | itemOfNode (size_t i) const |
Returns item of i-th node. More... | |
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.
| using jet::Bvh2< T >::ConstIterator = typename ContainerType::const_iterator |
| using jet::Bvh2< T >::ContainerType = std::vector<T> |
| ConstIterator jet::Bvh2< T >::begin | ( | ) | const |
Returns the immutable begin iterator of the item.
| const BoundingBox2D& jet::Bvh2< T >::boundingBox | ( | ) | const |
Returns bounding box of every items.
| void jet::Bvh2< T >::build | ( | const std::vector< T > & | items, |
| const std::vector< BoundingBox2D > & | itemsBounds | ||
| ) |
Builds bounding volume hierarchy.
| std::pair<size_t, size_t> jet::Bvh2< T >::children | ( | size_t | i | ) | const |
Returns the children indices of i-th node.
| void jet::Bvh2< T >::clear | ( | ) |
Clears all the contents of this instance.
|
overridevirtual |
Returns the closest intersection for given ray.
Implements jet::IntersectionQueryEngine2< T >.
| ConstIterator jet::Bvh2< T >::end | ( | ) | const |
Returns the immutable end iterator of the item.
|
overridevirtual |
Invokes visitorFunc for every intersecting items.
Implements jet::IntersectionQueryEngine2< T >.
|
overridevirtual |
Invokes visitorFunc for every intersecting items.
Implements jet::IntersectionQueryEngine2< T >.
|
overridevirtual |
Returns true if given box intersects with any of the stored items.
Implements jet::IntersectionQueryEngine2< T >.
|
overridevirtual |
Returns true if given ray intersects with any of the stored items.
Implements jet::IntersectionQueryEngine2< T >.
| bool jet::Bvh2< T >::isLeaf | ( | size_t | i | ) | const |
Returns true if i-th node is a leaf node.
| const T& jet::Bvh2< T >::item | ( | size_t | i | ) | const |
Returns the item at i.
| ConstIterator jet::Bvh2< T >::itemOfNode | ( | size_t | i | ) | const |
Returns item of i-th node.
|
overridevirtual |
Returns the nearest neighbor for given point and distance measure function.
Implements jet::NearestNeighborQueryEngine2< T >.
| const BoundingBox2D& jet::Bvh2< T >::nodeBound | ( | size_t | i | ) | const |
Returns bounding box of i-th node.
| size_t jet::Bvh2< T >::numberOfItems | ( | ) | const |
Returns the number of items.
| size_t jet::Bvh2< T >::numberOfNodes | ( | ) | const |
Returns the number of nodes.
1.8.18