PointNeighborSearcher2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: PointNeighborSearcher2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D neighbor point searcher.
6 > Created Time: 2017/04/28
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_POINT_NEIGHBOR_SEARCHER2_H
10 #define CUBBYFLOW_POINT_NEIGHBOR_SEARCHER2_H
11 
13 #include <Core/Vector/Vector2.h>
14 
15 #include <functional>
16 #include <memory>
17 #include <string>
18 
19 namespace CubbyFlow
20 {
30  {
31  public:
34  using ForEachNearbyPointFunc = std::function<void(size_t, const Vector2D&)>;
35 
38 
40  virtual ~PointNeighborSearcher2();
41 
43  virtual std::string TypeName() const = 0;
44 
46  virtual void Build(const ConstArrayAccessor1<Vector2D>& points) = 0;
47 
56  virtual void ForEachNearbyPoint(const Vector2D& origin, double radius, const ForEachNearbyPointFunc& callback) const = 0;
57 
67  virtual bool HasNearbyPoint(const Vector2D& origin, double radius) const = 0;
68 
75  virtual std::shared_ptr<PointNeighborSearcher2> Clone() const = 0;
76  };
77 
79  using PointNeighborSearcher2Ptr = std::shared_ptr<PointNeighborSearcher2>;
80 
83  {
84  public:
86 
89  };
90 
92  using PointNeighborSearcherBuilder2Ptr = std::shared_ptr<PointNeighborSearcherBuilder2>;
93 
94 #define CUBBYFLOW_NEIGHBOR_SEARCHER2_TYPE_NAME(DerivedClassName) \
95  std::string TypeName() const override \
96  { \
97  return #DerivedClassName; \
98  }
99 }
100 
101 #endif
Abstract base class for any serializable class.
Definition: Serialization.h:20
virtual void ForEachNearbyPoint(const Vector2D &origin, double radius, const ForEachNearbyPointFunc &callback) const =0
std::function< void(size_t, const Vector2D &)> ForEachNearbyPointFunc
Definition: PointNeighborSearcher2.h:34
1-D read-only array accessor class.
Definition: ArrayAccessor1.h:185
virtual PointNeighborSearcher2Ptr BuildPointNeighborSearcher() const =0
Returns shared pointer of PointNeighborSearcher2 type.
Abstract base class for 2-D point neighbor searcher builders.
Definition: PointNeighborSearcher2.h:82
Definition: pybind11Utils.h:24
Abstract base class for 2-D neighbor point searcher.
Definition: PointNeighborSearcher2.h:29
virtual std::string TypeName() const =0
Returns the type name of the derived class.
virtual std::shared_ptr< PointNeighborSearcher2 > Clone() const =0
Creates a new instance of the object with same properties than original.
std::shared_ptr< PointNeighborSearcherBuilder2 > PointNeighborSearcherBuilder2Ptr
Shared pointer for the PointNeighborSearcherBuilder2 type.
Definition: PointNeighborSearcher2.h:92
virtual ~PointNeighborSearcher2()
Destructor.
2-D vector class.
Definition: Vector2.h:26
PointNeighborSearcher2()
Default constructor.
std::shared_ptr< PointNeighborSearcher2 > PointNeighborSearcher2Ptr
Shared pointer for the PointNeighborSearcher2 type.
Definition: PointNeighborSearcher2.h:79
virtual bool HasNearbyPoint(const Vector2D &origin, double radius) const =0
virtual void Build(const ConstArrayAccessor1< Vector2D > &points)=0
Builds internal acceleration structure for given points list.