VTK  9.7.20261112
vtkKdTreePointLocator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
102
103#ifndef vtkKdTreePointLocator_h
104#define vtkKdTreePointLocator_h
105
107#include "vtkCommonDataModelModule.h" // For export macro
108
109#include <memory> // For std::unique_ptr
110
111VTK_ABI_NAMESPACE_BEGIN
112class vtkIdList;
113
114class VTKCOMMONDATAMODEL_EXPORT vtkKdTreePointLocator : public vtkAbstractPointLocator
115{
116public:
119 void PrintSelf(ostream& os, vtkIndent indent) override;
120
127 vtkIdType FindClosestPoint(const double x[3]) override;
128
134 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double& dist2) override;
135
144 void FindClosestNPoints(int N, const double x[3], vtkIdList* result) override;
145
152 void FindPointsWithinRadius(double R, const double x[3], vtkIdList* result) override;
153
165 double FindNPointsInShell(int N, const double x[3], vtkDist2TupleArray& results,
166 double minDist2 = -0.1, bool sort = true, vtkDoubleArray* petals = nullptr) override;
167
175 void FindPointsInShell(const double x[3], vtkDist2TupleArray& results, double minDist2,
176 double maxDist2, bool sort = true, vtkDoubleArray* petals = nullptr) override;
177
179
186 vtkSetClampMacro(NumberOfPointsPerLeaf, int, 1, VTK_INT_MAX);
187 vtkGetMacro(NumberOfPointsPerLeaf, int);
189
191
195 void FreeSearchStructure() override;
196 void BuildLocator() override;
197 void ForceBuildLocator() override;
198 void GenerateRepresentation(int level, vtkPolyData* pd) override;
200
209
210protected:
213
214 void BuildLocatorInternal() override;
215
217
218 struct vtkInternals;
219 std::unique_ptr<vtkInternals> Internals;
220
221private:
223 void operator=(const vtkKdTreePointLocator&) = delete;
224};
225
226VTK_ABI_NAMESPACE_END
227#endif
dynamic, self-adjusting array of double
list of point or cell ids
Definition vtkIdList.h:135
a simple class to control print indentation
Definition vtkIndent.h:108
void FindClosestNPoints(int N, const double x[3], vtkIdList *result) override
Find the closest N points to a position.
void BuildLocatorInternal() override
This function is not pure virtual to maintain backwards compatibility.
vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2) override
Given a position x and a radius r, return the id of the point closest to the point in that radius.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type and print methods.
std::unique_ptr< vtkInternals > Internals
void GenerateRepresentation(int level, vtkPolyData *pd) override
See vtkLocator interface documentation.
double FindNPointsInShell(int N, const double x[3], vtkDist2TupleArray &results, double minDist2=-0.1, bool sort=true, vtkDoubleArray *petals=nullptr) override
Find the N nearest points which are strictly greater than minDist2 away from the query point x,...
~vtkKdTreePointLocator() override
void ForceBuildLocator() override
See vtkLocator interface documentation.
void FindPointsInShell(const double x[3], vtkDist2TupleArray &results, double minDist2, double maxDist2, bool sort=true, vtkDoubleArray *petals=nullptr) override
Find all the points which are strictly greater than minDist2 and at most maxDist2 away from the query...
void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result) override
Find all points within a specified radius R of position x.
int GetDimension()
Return the dimension of the kd-tree: 2 when all the points are in a plane of constant z,...
void BuildLocator() override
See vtkLocator interface documentation.
vtkIdType FindClosestPoint(const double x[3]) override
Given a position x, return the id of the point closest to it.
void FreeSearchStructure() override
See vtkLocator interface documentation.
static vtkKdTreePointLocator * New()
concrete dataset represents vertices, lines, polygons, and triangle strips
Represent an array of vtkDist2Tuples.
int vtkIdType
Definition vtkType.h:366
#define VTK_INT_MAX
Definition vtkType.h:195