Jet  v1.3.3
point_kdtree_searcher2.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_POINT_KDTREE_SEARCHER2_H
8 #define INCLUDE_JET_POINT_KDTREE_SEARCHER2_H
9 
10 #include <jet/kdtree.h>
11 #include <jet/point2.h>
13 #include <jet/size2.h>
14 
15 #include <vector>
16 
17 namespace jet {
18 
26  public:
28 
29  class Builder;
30 
33 
36 
38  void build(const ConstArrayAccessor1<Vector2D>& points) override;
39 
49  const Vector2D& origin, double radius,
50  const ForEachNearbyPointFunc& callback) const override;
51 
61  bool hasNearbyPoint(const Vector2D& origin, double radius) const override;
62 
69  PointNeighborSearcher2Ptr clone() const override;
70 
73 
75  void set(const PointKdTreeSearcher2& other);
76 
78  void serialize(std::vector<uint8_t>* buffer) const override;
79 
81  void deserialize(const std::vector<uint8_t>& buffer) override;
82 
84  static Builder builder();
85 
86  private:
87  KdTree<double, 2> _tree;
88 };
89 
91 typedef std::shared_ptr<PointKdTreeSearcher2> PointKdTreeSearcher2Ptr;
92 
98  public:
101 
104 
107 };
108 
109 } // namespace jet
110 
111 #endif // INCLUDE_JET_POINT_KDTREE_SEARCHER2_H
jet::KdTree< double, 2 >
JET_NEIGHBOR_SEARCHER2_TYPE_NAME
#define JET_NEIGHBOR_SEARCHER2_TYPE_NAME(DerivedClassName)
Definition: point_neighbor_searcher2.h:95
jet::PointKdTreeSearcher2::clone
PointNeighborSearcher2Ptr clone() const override
Creates a new instance of the object with same properties than original.
jet::PointKdTreeSearcher2::deserialize
void deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the neighbor searcher from the buffer.
jet::PointKdTreeSearcher2::set
void set(const PointKdTreeSearcher2 &other)
Copy from the other instance.
jet::ConstArrayAccessor< T, 1 >
1-D read-only array accessor class.
Definition: array_accessor1.h:184
jet::PointKdTreeSearcher2::PointKdTreeSearcher2
PointKdTreeSearcher2()
Constructs an empty kD-tree instance.
jet::PointKdTreeSearcher2::PointKdTreeSearcher2
PointKdTreeSearcher2(const PointKdTreeSearcher2 &other)
Copy constructor.
point_neighbor_searcher2.h
jet::PointNeighborSearcher2Ptr
std::shared_ptr< PointNeighborSearcher2 > PointNeighborSearcher2Ptr
Shared pointer for the PointNeighborSearcher2 type.
Definition: point_neighbor_searcher2.h:82
jet::PointKdTreeSearcher2::Builder
Front-end to create PointKdTreeSearcher2 objects step by step.
Definition: point_kdtree_searcher2.h:97
jet::PointKdTreeSearcher2::Builder::buildPointNeighborSearcher
PointNeighborSearcher2Ptr buildPointNeighborSearcher() const override
Returns shared pointer of PointNeighborSearcher3 type.
size2.h
jet::PointKdTreeSearcher2Ptr
std::shared_ptr< PointKdTreeSearcher2 > PointKdTreeSearcher2Ptr
Shared pointer for the PointKdTreeSearcher2 type.
Definition: point_kdtree_searcher2.h:91
jet::PointKdTreeSearcher2::serialize
void serialize(std::vector< uint8_t > *buffer) const override
Serializes the neighbor searcher into the buffer.
jet
Definition: advection_solver2.h:18
kdtree.h
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::PointKdTreeSearcher2
KdTree-based 2-D point searcher.
Definition: point_kdtree_searcher2.h:25
jet::PointKdTreeSearcher2::build
void build(const ConstArrayAccessor1< Vector2D > &points) override
Builds internal acceleration structure for given points list.
jet::PointKdTreeSearcher2::Builder::makeShared
PointKdTreeSearcher2Ptr makeShared() const
Builds shared pointer of PointKdTreeSearcher2 instance.
jet::PointNeighborSearcher2::ForEachNearbyPointFunc
std::function< void(size_t, const Vector2D &)> ForEachNearbyPointFunc
Definition: point_neighbor_searcher2.h:33
jet::PointNeighborSearcherBuilder2
Abstract base class for 2-D point neighbor searcher builders.
Definition: point_neighbor_searcher2.h:85
jet::PointKdTreeSearcher2::hasNearbyPoint
bool hasNearbyPoint(const Vector2D &origin, double radius) const override
jet::PointKdTreeSearcher2::operator=
PointKdTreeSearcher2 & operator=(const PointKdTreeSearcher2 &other)
Assignment operator.
jet::PointNeighborSearcher2
Abstract base class for 2-D neighbor point searcher.
Definition: point_neighbor_searcher2.h:28
jet::PointKdTreeSearcher2::forEachNearbyPoint
void forEachNearbyPoint(const Vector2D &origin, double radius, const ForEachNearbyPointFunc &callback) const override
jet::PointKdTreeSearcher2::Builder::build
PointKdTreeSearcher2 build() const
Builds PointKdTreeSearcher2 instance.
jet::PointKdTreeSearcher2::builder
static Builder builder()
Returns builder fox PointKdTreeSearcher2.
point2.h