Go to the documentation of this file.
7 #ifndef INCLUDE_JET_QUADTREE_H_
8 #define INCLUDE_JET_QUADTREE_H_
30 typedef typename ContainerType::iterator
Iterator;
89 const T&
item(
size_t i)
const;
120 std::vector<size_t> items;
125 size_t _maxDepth = 1;
127 std::vector<T> _items;
128 std::vector<Node> _nodes;
130 void build(
size_t nodeIdx,
size_t currentDepth,
162 #include "detail/quadtree-inl.h"
164 #endif // INCLUDE_JET_QUADTREE_H_
NearestNeighborQueryResult2< T > nearest(const Vector2D &pt, const NearestNeighborDistanceFunc2< T > &distanceFunc) const override
Abstract base class for 2-D intersection test query engine.
Definition: intersection_query_engine2.h:48
size_t childIndex(size_t nodeIdx, size_t childIdx) const
Returns a child's index for given node.
Class for 2-D ray.
Definition: ray2.h:21
Nearest neighbor query result.
Definition: nearest_neighbor_query_engine2.h:19
const T & item(size_t i) const
Returns the item at i.
bool intersects(const BoundingBox2D &box, const BoxIntersectionTestFunc2< T > &testFunc) const override
Returns true if given box intersects with any of the stored items.
bool intersects(const Ray2D &ray, const RayIntersectionTestFunc2< T > &testFunc) const override
Returns true if given ray intersects with any of the stored items.
constexpr size_t kMaxSize
Max size_t.
Definition: constants.h:79
ConstIterator end() const
Returns the immutable end iterator of the item.
Definition: advection_solver2.h:18
std::function< bool(const T &, const BoundingBox2D &)> BoxIntersectionTestFunc2
Box-item intersection test function.
Definition: intersection_query_engine2.h:32
ConstIterator begin() const
Returns the immutable begin iterator of the item.
void forEachIntersectingItem(const Ray2D &ray, const RayIntersectionTestFunc2< T > &testFunc, const IntersectionVisitorFunc2< T > &visitorFunc) const override
Invokes visitorFunc for every intersecting items.
void forEachIntersectingItem(const BoundingBox2D &box, const BoxIntersectionTestFunc2< T > &testFunc, const IntersectionVisitorFunc2< T > &visitorFunc) const override
Invokes visitorFunc for every intersecting items.
2-D vector class.
Definition: vector2.h:24
Abstract base class for 2-D nearest neigbor query engine.
Definition: nearest_neighbor_query_engine2.h:31
std::vector< T > ContainerType
Definition: quadtree.h:29
std::function< double(const T &, const Ray2D &)> GetRayIntersectionFunc2
Ray-item closest intersection evaluation function.
Definition: intersection_query_engine2.h:40
void clear()
Clears all the contents of this instance.
ContainerType::const_iterator ConstIterator
Definition: quadtree.h:31
std::function< double(const T &, const Vector2D &)> NearestNeighborDistanceFunc2
Nearest neighbor distance measure function.
Definition: nearest_neighbor_query_engine2.h:27
std::function< void(const T &)> IntersectionVisitorFunc2
Visitor function which is invoked for each intersecting item.
Definition: intersection_query_engine2.h:44
2-D axis-aligned bounding box class.
Definition: bounding_box2.h:41
ClosestIntersectionQueryResult2< T > closestIntersection(const Ray2D &ray, const GetRayIntersectionFunc2< T > &testFunc) const override
Returns the closest intersection for given ray.
ContainerType::iterator Iterator
Definition: quadtree.h:30
size_t maxDepth() const
Returns the maximum depth of the tree.
Iterator end()
Returns the end iterator of the item.
void build(const std::vector< T > &items, const BoundingBox2D &bound, const BoxIntersectionTestFunc2< T > &testFunc, size_t maxDepth)
size_t numberOfNodes() const
Returns the number of quadtree nodes.
Generic quadtree data structure.
Definition: quadtree.h:27
size_t numberOfItems() const
Returns the number of items.
Quadtree()
Default constructor.
Iterator begin()
Returns the begin iterator of the item.
const BoundingBox2D & boundingBox() const
Returns the bounding box of this quadtree.
Closest intersection query result.
Definition: intersection_query_engine2.h:19
std::function< bool(const T &, const Ray2D &)> RayIntersectionTestFunc2
Ray-item intersection test function.
Definition: intersection_query_engine2.h:36
const std::vector< size_t > & itemsAtNode(size_t nodeIdx) const
Returns the list of the items for given noide index.