VTK  9.7.1
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 
32 VTK_ABI_NAMESPACE_BEGIN
33 
35 class vtkDoubleArray;
36 struct InternalShellBinIterator;
37 
38 // A simple dispatch mechanism to internal, templated classes.
39 VTK_WRAPEXCLUDE struct VTKFILTERSMESHING_EXPORT vtkShellBinIteratorDispatch
40 {
41  bool LargeIds;
42  InternalShellBinIterator* Iterator;
43 
45  : LargeIds(false)
46  , Iterator(nullptr)
47  {
48  }
49  vtkShellBinIteratorDispatch(vtkStaticPointLocator* loc) { this->Initialize(loc); }
50  void Initialize(vtkStaticPointLocator* locator);
51  bool Begin(vtkIdType pid, double x[3], vtkDist2TupleArray& results);
52  bool Next(double radius2, vtkDoubleArray* spheres, vtkDist2TupleArray& results);
53  vtkIdType GetBinId();
54  void GetBin(int IJK[3]);
55  double GetMinD2();
56 }; // vtkShellBinIteratorDispatch
57 
58 // VTK class proper
59 class VTKFILTERSMESHING_EXPORT vtkShellBinIterator
60 {
61 public:
65  vtkShellBinIterator() = default;
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 
120 private:
121  // Used to dispatch to the internally instantiated templated classes.
123 };
124 
125 VTK_ABI_NAMESPACE_END
126 
127 #endif
128 // VTK-HeaderTest-Exclude: vtkShellBinIterator.h
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]...
void GetBin(int IJK[3])
Return the current bin/bucket index IJK of traversal.
int vtkIdType
Definition: vtkType.h:363
vtkShellBinIteratorDispatch(vtkStaticPointLocator *loc)
dynamic, self-adjusting array of double
void Initialize(vtkStaticPointLocator *locator)
Initialize an iterator with the associated vtkStaticPointLocator over which to iterate.
A fast, lightweight class for iterating over the bins of a 3D vtkStaticPointLocator.
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...
quickly locate points in 3-space
InternalShellBinIterator * Iterator
bool Begin(vtkIdType ptId, double x[3], vtkDist2TupleArray &results)
Begin iterating over the bins, starting with point ptId at position x[3].
Represent an array of vtkDist2Tuples.
#define VTK_WRAPEXCLUDE
vtkIdType GetBinId()
Return the current bin/bucket id of traversal.