56 KDTree(
const std::vector<float> &x,
const std::vector<float> &y);
62 explicit KDTree(
const std::vector<Point> &points);
91 bool empty() const noexcept;
97 size_t size() const noexcept;
123 size_t nearest(
float x_query,
float y_query) const;
133 size_t nearest(const glm::vec2 &xy) const;
143 float y_query) const;
156 const glm::vec2 &xy) const;
170 std::vector<
size_t> &indices,
171 std::vector<
float> &distances) const;
178 std::vector<
size_t> &indices,
179 std::vector<
float> &distances) const;
186 std::vector<
size_t> &indices,
187 std::vector<
float> &distances) const;
197 std::vector<std::pair<
size_t,
float>>
radius_search(
float x_query,
210 std::vector<std::pair<
size_t,
float>>
radius_search(const glm::vec2 &xy,
216 std::unique_ptr<
Impl> p_impl;
Represents a collection of unordered points in 2D space.
Definition cloud.hpp:61
size_t size() const noexcept
Get the number of points indexed by the KD-tree.
Definition kd_tree.cpp:254
glm::vec2 compute_neighbor_distance_range(size_t k_neighbors) const
Estimate the range of neighbor distances across the dataset.
Definition kd_tree.cpp:263
KDTree()
Construct an empty KD-tree.
std::pair< size_t, float > nearest_with_distance_squared(float x_query, float y_query) const
Find the index and squared distance of the nearest neighbor.
Definition kd_tree.cpp:315
bool empty() const noexcept
Check whether the KD-tree is empty.
Definition kd_tree.cpp:249
size_t nearest(float x_query, float y_query) const
Find the index of the nearest neighbor to a 2D query position.
Definition kd_tree.cpp:300
KDTree(KDTree &&other) noexcept
Move constructor.
KDTree & operator=(KDTree &&other) noexcept
Move assignment operator.
std::vector< std::pair< size_t, float > > radius_search(float x_query, float y_query, float radius) const
Perform a radius-based neighbor search.
Definition kd_tree.cpp:366
KDTree & operator=(const KDTree &)=delete
KDTree(const KDTree &)=delete
void neighbor_search(float x_query, float y_query, size_t k_neighbors, std::vector< size_t > &indices, std::vector< float > &distances) const
Perform a k-nearest neighbor search.
Definition kd_tree.cpp:335
A class to represent and manipulate 2D points that can carry a value.
Definition point.hpp:26
Definition kd_tree.cpp:84