PointKdTreeSearcher3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: PointKdTreeSearcher3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: KdTree-based 3-D point searcher.
6 > Created Time: 2017/12/05
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_POINT_KDTREE_SEARCHER3_H
10 #define CUBBYFLOW_POINT_KDTREE_SEARCHER3_H
11 
12 #include <Core/Geometry/KdTree.h>
14 
15 namespace CubbyFlow
16 {
24  {
25  public:
27 
28  class Builder;
29 
32 
35 
37  void Build(const ConstArrayAccessor1<Vector3D>& points) override;
38 
47  void ForEachNearbyPoint(
48  const Vector3D& origin, double radius,
49  const ForEachNearbyPointFunc& callback) const override;
50 
60  bool HasNearbyPoint(const Vector3D& origin, double radius) const override;
61 
68  PointNeighborSearcher3Ptr Clone() const override;
69 
72 
74  void Set(const PointKdTreeSearcher3& other);
75 
77  void Serialize(std::vector<uint8_t>* buffer) const override;
78 
80  void Deserialize(const std::vector<uint8_t>& buffer) override;
81 
83  static Builder GetBuilder();
84 
85  private:
86  KdTree<double, 3> m_tree;
87  };
88 
90  using PointKdTreeSearcher3Ptr = std::shared_ptr<PointKdTreeSearcher3>;
91 
96  {
97  public:
100 
103 
106  };
107 }
108 
109 #endif
3-D vector class.
Definition: Vector3.h:26
PointNeighborSearcher3Ptr BuildPointNeighborSearcher() const override
Returns shared pointer of PointNeighborSearcher3 type.
PointNeighborSearcher3Ptr Clone() const override
Creates a new instance of the object with same properties than original.
std::function< void(size_t, const Vector3D &)> ForEachNearbyPointFunc
Definition: PointNeighborSearcher3.h:34
Front-end to create PointKdTreeSearcher3 objects step by step.
Definition: PointKdTreeSearcher3.h:95
std::shared_ptr< PointNeighborSearcher3 > PointNeighborSearcher3Ptr
Shared pointer for the PointNeighborSearcher3 type.
Definition: PointNeighborSearcher3.h:79
PointKdTreeSearcher3()
Constructs an empty kD-tree instance.
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the neighbor searcher into the buffer.
PointKdTreeSearcher3 & operator=(const PointKdTreeSearcher3 &other)
Assignment operator.
void ForEachNearbyPoint(const Vector3D &origin, double radius, const ForEachNearbyPointFunc &callback) const override
1-D read-only array accessor class.
Definition: ArrayAccessor1.h:185
Definition: pybind11Utils.h:24
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the neighbor searcher from the buffer.
PointKdTreeSearcher3 Build() const
Builds PointKdTreeSearcher3 instance.
static Builder GetBuilder()
Returns builder fox PointKdTreeSearcher3.
PointKdTreeSearcher3Ptr MakeShared() const
Builds shared pointer of PointKdTreeSearcher3 instance.
Abstract base class for 3-D point neighbor searcher builders.
Definition: PointNeighborSearcher3.h:82
Abstract base class for 3-D neighbor point searcher.
Definition: PointNeighborSearcher3.h:29
std::shared_ptr< PointKdTreeSearcher3 > PointKdTreeSearcher3Ptr
Shared pointer for the PointKdTreeSearcher3 type.
Definition: PointKdTreeSearcher3.h:90
void Build(const ConstArrayAccessor1< Vector3D > &points) override
Builds internal acceleration structure for given points list.
#define CUBBYFLOW_NEIGHBOR_SEARCHER3_TYPE_NAME(DerivedClassName)
Definition: PointNeighborSearcher3.h:94
bool HasNearbyPoint(const Vector3D &origin, double radius) const override
void Set(const PointKdTreeSearcher3 &other)
Copy from the other instance.
KdTree-based 3-D point searcher.
Definition: PointKdTreeSearcher3.h:23