VTK  9.7.1
vtkAnnularBinIterator.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 vtkAnnularBinIterator_h
26 #define vtkAnnularBinIterator_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 #include <iostream>
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 
37 class vtkDoubleArray;
38 struct InternalAnnularBinIterator;
39 
40 // A simple dispatch mechanism to internal, templated classes.
41 VTK_WRAPEXCLUDE struct VTKFILTERSMESHING_EXPORT vtkAnnularBinIteratorDispatch
42 {
43  bool LargeIds;
44  InternalAnnularBinIterator* Iterator;
45 
47  : LargeIds(false)
48  , Iterator(nullptr)
49  {
50  }
52  {
53  this->LargeIds = false;
54  this->Iterator = nullptr;
55  }
57 
58  vtkAnnularBinIteratorDispatch(vtkStaticPointLocator2D* loc) { this->Initialize(loc); }
59  void Initialize(vtkStaticPointLocator2D* locator);
60  bool Begin(vtkIdType pid, double x[3], vtkDist2TupleArray& results);
61  bool Next(double radius2, vtkDoubleArray* spheres, vtkDist2TupleArray& results);
62  vtkIdType GetBinId();
63  void GetBin(int IJ[2]);
64  double GetMinD2();
65 }; // vtkAnnularBinIteratorDispatch
66 
67 // VTK class proper
68 class VTKFILTERSMESHING_EXPORT vtkAnnularBinIterator
69 {
70 public:
74  vtkAnnularBinIterator() = default;
77 
84  : Dispatch(loc)
85  {
86  }
87 
93  void Initialize(vtkStaticPointLocator2D* locator) { this->Dispatch.Initialize(locator); }
94 
100  bool Begin(vtkIdType ptId, double x[3], vtkDist2TupleArray& results)
101  {
102  return this->Dispatch.Begin(ptId, x, results);
103  }
104 
110  bool Next(double radius2, vtkDoubleArray* circles, vtkDist2TupleArray& results)
111  {
112  return this->Dispatch.Next(radius2, circles, results);
113  }
114 
118  vtkIdType GetBinId() { return this->Dispatch.GetBinId(); }
119 
123  void GetBin(int IJ[2]) { this->Dispatch.GetBin(IJ); }
124 
129  double GetMinD2() { return this->Dispatch.GetMinD2(); }
130 
131 private:
132  // Used to dispatch to the internally instantiated templated classes.
134 };
135 
136 VTK_ABI_NAMESPACE_END
137 
138 #endif
139 // VTK-HeaderTest-Exclude: vtkAnnularBinIterator.h
double GetMinD2()
Return the minimum distance of the current annulus of bins to the initial starting point x[2]...
bool Next(double radius2, vtkDoubleArray *circles, vtkDist2TupleArray &results)
Move to the next bin, returning all points that are inside the circle given by x[2] (specified in Beg...
vtkAnnularBinIteratorDispatch & operator=(const vtkAnnularBinIteratorDispatch &)
vtkAnnularBinIteratorDispatch(const vtkAnnularBinIteratorDispatch &)
int vtkIdType
Definition: vtkType.h:363
void GetBin(int IJ[2])
Return the current bin/bucket index IJ of traversal.
bool Begin(vtkIdType ptId, double x[3], vtkDist2TupleArray &results)
Begin iterating over the bins, starting with point ptId at position x[3].
void Initialize(vtkStaticPointLocator2D *locator)
Initialize an iterator with the associated vtkStaticPointLocator2D over which to iterate.
vtkAnnularBinIterator(vtkStaticPointLocator2D *loc)
Construct the iterator with a vtkStaticPointLocator2D.
dynamic, self-adjusting array of double
InternalAnnularBinIterator * Iterator
vtkAnnularBinIteratorDispatch(vtkStaticPointLocator2D *loc)
vtkAnnularBinIterator & operator=(const vtkAnnularBinIterator &)
vtkIdType GetBinId()
Return the current bin/bucket id of traversal.
Represent an array of vtkDist2Tuples.
vtkAnnularBinIterator(const vtkAnnularBinIterator &)
#define VTK_WRAPEXCLUDE
A fast, lightweight class for iterating over the bins of a 2D vtkStaticPointLocator2D.
quickly locate points in 2-space