VTK  9.6.20260112
vtkShellBinIterator.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
25#ifndef vtkShellBinIterator_h
26#define vtkShellBinIterator_h
27
28#include "vtkFiltersMeshingModule.h" // For export macro
29#include "vtkLocatorInterface.h" // for array of (pt,d**2) tuples
30#include "vtkSystemIncludes.h"
31
32VTK_ABI_NAMESPACE_BEGIN
33
35class vtkDoubleArray;
36struct InternalShellBinIterator;
37
38// A simple dispatch mechanism to internal, templated classes.
39VTK_WRAPEXCLUDE struct VTKFILTERSMESHING_EXPORT vtkShellBinIteratorDispatch
40{
42 InternalShellBinIterator* Iterator;
43
45 : LargeIds(false)
46 , Iterator(nullptr)
47 {
48 }
51 bool Begin(vtkIdType pid, double x[3], vtkDist2TupleArray& results);
52 bool Next(double radius2, vtkDoubleArray* spheres, vtkDist2TupleArray& results);
54 void GetBin(int IJK[3]);
55 double GetMinD2();
56}; // vtkShellBinIteratorDispatch
57
58// VTK class proper
59class VTKFILTERSMESHING_EXPORT vtkShellBinIterator
60{
61public:
66
73 : Dispatch(loc)
74 {
75 }
76
82 void Initialize(vtkStaticPointLocator* locator) { this->Dispatch.Initialize(locator); }
83
89 bool Begin(vtkIdType ptId, double x[3], vtkDist2TupleArray& results)
90 {
91 return this->Dispatch.Begin(ptId, x, results);
92 }
93
99 bool Next(double radius2, vtkDoubleArray* spheres, vtkDist2TupleArray& results)
100 {
101 return this->Dispatch.Next(radius2, spheres, results);
102 }
103
107 vtkIdType GetBinId() { return this->Dispatch.GetBinId(); }
108
112 void GetBin(int IJK[3]) { this->Dispatch.GetBin(IJK); }
113
118 double GetMinD2() { return this->Dispatch.GetMinD2(); }
119
120private:
121 // Used to dispatch to the internally instantiated templated classes.
123};
124
125VTK_ABI_NAMESPACE_END
126
127#endif
128// VTK-HeaderTest-Exclude: vtkShellBinIterator.h
dynamic, self-adjusting array of double
void Initialize(vtkStaticPointLocator *locator)
Initialize an iterator with the associated vtkStaticPointLocator over which to iterate.
vtkShellBinIterator(vtkStaticPointLocator *loc)
Construct the iterator with a vtkStaticPointLocator.
double GetMinD2()
Return the minimum distance of the current shell of bins to the initial starting point x[3].
vtkIdType GetBinId()
Return the current bin/bucket id of traversal.
void GetBin(int IJK[3])
Return the current bin/bucket index IJK of traversal.
bool Next(double radius2, vtkDoubleArray *spheres, vtkDist2TupleArray &results)
Move to the next bin, returning all points that are inside the sphere given by x[3] (specified in Beg...
vtkShellBinIterator()=default
Construct a default iterator.
bool Begin(vtkIdType ptId, double x[3], vtkDist2TupleArray &results)
Begin iterating over the bins, starting with point ptId at position x[3].
quickly locate points in 3-space
Represent an array of vtkDist2Tuples.
InternalShellBinIterator * Iterator
void Initialize(vtkStaticPointLocator *locator)
vtkShellBinIteratorDispatch(vtkStaticPointLocator *loc)
bool Next(double radius2, vtkDoubleArray *spheres, vtkDist2TupleArray &results)
bool Begin(vtkIdType pid, double x[3], vtkDist2TupleArray &results)
int vtkIdType
Definition vtkType.h:368
#define VTK_WRAPEXCLUDE