VTK  9.3.1
vtkStaticCellLocator.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
40 #ifndef vtkStaticCellLocator_h
41 #define vtkStaticCellLocator_h
42 
43 #include "vtkAbstractCellLocator.h"
44 #include "vtkCommonDataModelModule.h" // For export macro
45 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
46 
47 // Forward declarations for PIMPL
48 VTK_ABI_NAMESPACE_BEGIN
49 struct vtkCellBinner;
50 struct vtkCellProcessor;
51 
52 class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
53 {
54  friend struct vtkCellBinner;
55  friend struct vtkCellProcessor;
56 
57 public:
59 
62  static vtkStaticCellLocator* New();
64  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68 
74  vtkSetVector3Macro(Divisions, int);
75  vtkGetVectorMacro(Divisions, int, 3);
77 
79 
93  vtkSetClampMacro(MaxNumberOfBuckets, vtkIdType, 1000, VTK_ID_MAX);
94  vtkGetMacro(MaxNumberOfBuckets, vtkIdType);
96 
104  bool GetLargeIds() { return this->LargeIds; }
105 
107 
118  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
119  vtkSetMacro(UseDiagonalLengthTolerance, bool);
120  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
121  vtkGetMacro(UseDiagonalLengthTolerance, bool);
122  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
123  virtual void UseDiagonalLengthToleranceOn()
124  {
125  if (this->UseDiagonalLengthTolerance != true)
126  {
127  this->UseDiagonalLengthTolerance = true;
128  this->Modified();
129  }
130  }
131  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
132  virtual void UseDiagonalLengthToleranceOff()
133  {
134  if (this->UseDiagonalLengthTolerance != false)
135  {
136  this->UseDiagonalLengthTolerance = false;
137  this->Modified();
138  }
139  }
141 
142  // Re-use any superclass signatures that we don't override.
147 
154  int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
155  double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
156 
166  int IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkPoints* points,
167  vtkIdList* cellIds, vtkGenericCell* cell) override;
168 
178  void FindClosestPoint(const double x[3], double closestPoint[3], vtkGenericCell* cell,
179  vtkIdType& cellId, int& subId, double& dist2) override
180  {
181  this->Superclass::FindClosestPoint(x, closestPoint, cell, cellId, subId, dist2);
182  }
183 
194  vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
195  vtkGenericCell* cell, vtkIdType& cellId, int& subId, double& dist2, int& inside) override;
196 
201  void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
202 
212  const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
213  {
214  this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
215  }
216 
223  void FindCellsAlongPlane(
224  const double o[3], const double n[3], double tolerance, vtkIdList* cells) override;
225 
233  vtkIdType FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell* GenCell, int& subId,
234  double pcoords[3], double* weights) override;
235 
240  bool InsideCellBounds(double x[3], vtkIdType cellId) override;
241 
243 
246  void GenerateRepresentation(int level, vtkPolyData* pd) override;
247  void FreeSearchStructure() override;
248  void BuildLocator() override;
249  void ForceBuildLocator() override;
251 
255  void ShallowCopy(vtkAbstractCellLocator* locator) override;
256 
257 protected:
259  ~vtkStaticCellLocator() override;
260 
261  void BuildLocatorInternal() override;
262 
263  double Bounds[6]; // Bounding box of the whole dataset
264  int Divisions[3]; // Number of sub-divisions in x-y-z directions
265  double H[3]; // Width of each bin in x-y-z directions
266 
267  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
268  bool LargeIds; // indicate whether integer ids are small or large
269 
270  // VTK_DEPRECATED_IN_9_2_0 This attribute needs to be removed
271  bool UseDiagonalLengthTolerance = false;
272 
273  // Support PIMPLd implementation
274  vtkCellBinner* Binner; // Does the binning
275  vtkCellProcessor* Processor; // Invokes methods (templated subclasses)
276 
277 private:
279  void operator=(const vtkStaticCellLocator&) = delete;
280 };
281 
282 VTK_ABI_NAMESPACE_END
283 #endif
virtual void BuildLocator()=0
Build the locator from the input dataset.
virtual vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3], vtkIdType &cellId, int &subId, double &dist2)
Return the closest point within a specified radius and the cell which is closest to the point x...
virtual void FindCellsWithinBounds(double *bbox, vtkIdList *cells)
Return a list of unique cell ids inside of a given bounding box.
virtual bool InsideCellBounds(double x[3], vtkIdType cell_ID)
Quickly test if a point is inside the bounds of a particular cell.
#define VTK_DEPRECATED_IN_9_2_0(reason)
an abstract base class for locators which find cells
perform fast cell location operations
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
provides thread-safe access to cells
virtual void FindClosestPoint(const double x[3], double closestPoint[3], vtkIdType &cellId, int &subId, double &dist2)
Return the closest point and the cell which is closest to the point x.
virtual void ShallowCopy(vtkAbstractCellLocator *)
Shallow copy of a vtkAbstractCellLocator.
virtual int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId)
Return intersection point (if any) of finite line with cells contained in cell locator.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void BuildLocatorInternal()
This function is not pure virtual to maintain backwards compatibility.
Definition: vtkLocator.h:192
virtual vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.
list of point or cell ids
Definition: vtkIdList.h:22
void FindCellsAlongLine(const double p1[3], const double p2[3], double tolerance, vtkIdList *cellsIds) override
Take the passed line segment and intersect it with the data set.
vtkCellProcessor * Processor
virtual void Modified()
Update the modification time for this object.
bool GetLargeIds()
Inform the user as to whether large ids are being used.
void FindClosestPoint(const double x[3], double closestPoint[3], vtkGenericCell *cell, vtkIdType &cellId, int &subId, double &dist2) override
Return the closest point and the cell which is closest to the point x.
#define VTK_ID_MAX
Definition: vtkType.h:319
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void FindCellsAlongPlane(const double o[3], const double n[3], double tolerance, vtkIdList *cells)
Given an unbounded plane defined by an origin o[3] and unit normal n[3], return the list of unique ce...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
represent and manipulate 3D points
Definition: vtkPoints.h:28
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:156