VTK  9.2.6
vtkStaticCellLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStaticCellLocator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
52 #ifndef vtkStaticCellLocator_h
53 #define vtkStaticCellLocator_h
54 
55 #include "vtkAbstractCellLocator.h"
56 #include "vtkCommonDataModelModule.h" // For export macro
57 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
58 
59 // Forward declarations for PIMPL
60 struct vtkCellBinner;
61 struct vtkCellProcessor;
62 
63 class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
64 {
65  friend struct vtkCellBinner;
66  friend struct vtkCellProcessor;
67 
68 public:
70 
73  static vtkStaticCellLocator* New();
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
79 
85  vtkSetVector3Macro(Divisions, int);
86  vtkGetVectorMacro(Divisions, int, 3);
88 
90 
104  vtkSetClampMacro(MaxNumberOfBuckets, vtkIdType, 1000, VTK_ID_MAX);
105  vtkGetMacro(MaxNumberOfBuckets, vtkIdType);
107 
115  bool GetLargeIds() { return this->LargeIds; }
116 
118 
129  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
130  vtkSetMacro(UseDiagonalLengthTolerance, bool);
131  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
132  vtkGetMacro(UseDiagonalLengthTolerance, bool);
133  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
134  virtual void UseDiagonalLengthToleranceOn()
135  {
136  if (this->UseDiagonalLengthTolerance != true)
137  {
138  this->UseDiagonalLengthTolerance = true;
139  this->Modified();
140  }
141  }
142  VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
143  virtual void UseDiagonalLengthToleranceOff()
144  {
145  if (this->UseDiagonalLengthTolerance != false)
146  {
147  this->UseDiagonalLengthTolerance = false;
148  this->Modified();
149  }
150  }
152 
153  // Re-use any superclass signatures that we don't override.
158 
165  int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
166  double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
167 
177  int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints* points,
178  vtkIdList* cellIds, vtkGenericCell* cell) override;
179 
189  void FindClosestPoint(const double x[3], double closestPoint[3], vtkGenericCell* cell,
190  vtkIdType& cellId, int& subId, double& dist2) override
191  {
192  this->Superclass::FindClosestPoint(x, closestPoint, cell, cellId, subId, dist2);
193  }
194 
205  vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
206  vtkGenericCell* cell, vtkIdType& cellId, int& subId, double& dist2, int& inside) override;
207 
212  void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
213 
223  const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
224  {
225  this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
226  }
227 
234  void FindCellsAlongPlane(
235  const double o[3], const double n[3], double tolerance, vtkIdList* cells) override;
236 
244  vtkIdType FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell* GenCell, int& subId,
245  double pcoords[3], double* weights) override;
246 
251  bool InsideCellBounds(double x[3], vtkIdType cellId) override;
252 
254 
257  void GenerateRepresentation(int level, vtkPolyData* pd) override;
258  void FreeSearchStructure() override;
259  void BuildLocator() override;
260  void ForceBuildLocator() override;
262 
266  void ShallowCopy(vtkAbstractCellLocator* locator) override;
267 
268 protected:
270  ~vtkStaticCellLocator() override;
271 
272  void BuildLocatorInternal() override;
273 
274  double Bounds[6]; // Bounding box of the whole dataset
275  int Divisions[3]; // Number of sub-divisions in x-y-z directions
276  double H[3]; // Width of each bin in x-y-z directions
277 
278  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
279  bool LargeIds; // indicate whether integer ids are small or large
280 
281  // VTK_DEPRECATED_IN_9_2_0 This attribute needs to be removed
282  bool UseDiagonalLengthTolerance = false;
283 
284  // Support PIMPLd implementation
285  vtkCellBinner* Binner; // Does the binning
286  vtkCellProcessor* Processor; // Invokes methods (templated subclasses)
287 
288 private:
290  void operator=(const vtkStaticCellLocator&) = delete;
291 };
292 
293 #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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:39
virtual void BuildLocatorInternal()
This function is not pure virtual to maintain backwards compatibility.
Definition: vtkLocator.h:203
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:33
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:336
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:39
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:167