VTK  9.0.1
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 =========================================================================*/
40 #ifndef vtkStaticCellLocator_h
41 #define vtkStaticCellLocator_h
42 
43 #include "vtkAbstractCellLocator.h"
44 #include "vtkCommonDataModelModule.h" // For export macro
45 
46 // Forward declarations for PIMPL
47 struct vtkCellBinner;
48 struct vtkCellProcessor;
49 
50 class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
51 {
52  friend struct vtkCellBinner;
53  friend struct vtkCellProcessor;
54 
55 public:
57 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
72  vtkSetVector3Macro(Divisions, int);
73  vtkGetVectorMacro(Divisions, int, 3);
75 
78 
83  vtkIdType FindCell(double pos[3], double vtkNotUsed, vtkGenericCell* cell, double pcoords[3],
84  double* weights) override;
85 
89  vtkIdType FindCell(double x[3]) override { return this->Superclass::FindCell(x); }
90 
96  void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
97 
106  const double p1[3], const double p2[3], double tolerance, vtkIdList* cells) override;
107 
109 
117  const double o[3], const double n[3], double tolerance, vtkIdList* cells);
119 
131  void FindClosestPoint(const double x[3], double closestPoint[3], vtkGenericCell* cell,
132  vtkIdType& cellId, int& subId, double& dist2) override;
133 
150  vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
151  vtkGenericCell* cell, vtkIdType& cellId, int& subId, double& dist2, int& inside) override;
152 
157  int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
158  double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
159 
163  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
164  double pcoords[3], int& subId) override
165  {
166  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId);
167  }
168 
172  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
173  double pcoords[3], int& subId, vtkIdType& cellId) override
174  {
175  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId, cellId);
176  }
177 
182  const double p1[3], const double p2[3], vtkPoints* points, vtkIdList* cellIds) override
183  {
184  return this->Superclass::IntersectWithLine(p1, p2, points, cellIds);
185  }
186 
188 
191  void GenerateRepresentation(int level, vtkPolyData* pd) override;
192  void FreeSearchStructure() override;
193  void BuildLocator() override;
195 
197 
211  vtkSetClampMacro(MaxNumberOfBuckets, vtkIdType, 1000, VTK_ID_MAX);
212  vtkGetMacro(MaxNumberOfBuckets, vtkIdType);
214 
222  bool GetLargeIds() { return this->LargeIds; }
223 
224 protected:
227 
228  double Bounds[6]; // Bounding box of the whole dataset
229  int Divisions[3]; // Number of sub-divisions in x-y-z directions
230  double H[3]; // Width of each bin in x-y-z directions
231 
232  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
233  bool LargeIds; // indicate whether integer ids are small or large
234 
235  // Support PIMPLd implementation
236  vtkCellBinner* Binner; // Does the binning
237  vtkCellProcessor* Processor; // Invokes methods (templated subclasses)
238 
239  // Support query operations
240  unsigned char* CellHasBeenVisited;
241  unsigned char QueryNumber;
242 
243 private:
245  void operator=(const vtkStaticCellLocator&) = delete;
246 };
247 
248 #endif
an abstract base class for locators which find 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 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.
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
represent and manipulate 3D points
Definition: vtkPoints.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
perform fast cell location operations
static vtkStaticCellLocator * New()
Standard methods to instantiate, print and obtain type-related information.
int IntersectWithLine(const double p1[3], const double p2[3], vtkPoints *points, vtkIdList *cellIds) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3], vtkGenericCell *cell, vtkIdType &cellId, int &subId, double &dist2, int &inside) override
Return the closest point within a specified radius and the cell which is closest to the point x.
vtkIdType FindCell(double x[3]) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
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.
void FindCellsWithinBounds(double *bbox, vtkIdList *cells) override
Return a list of unique cell ids inside of a given bounding box.
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
void BuildLocator() override
Build the locator from the input dataset.
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...
~vtkStaticCellLocator() override
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId, vtkIdType &cellId) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
vtkCellProcessor * Processor
bool GetLargeIds()
Inform the user as to whether large ids are being used.
unsigned char * CellHasBeenVisited
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GenerateRepresentation(int level, vtkPolyData *pd) override
Satisfy vtkLocator abstract interface.
void FreeSearchStructure() override
Free the memory required for the spatial data structure.
int IntersectWithLine(const double a0[3], const double a1[3], double tol, double &t, double x[3], double pcoords[3], int &subId, vtkIdType &cellId, vtkGenericCell *cell) override
Return intersection point (if any) AND the cell which was intersected by the finite line.
void FindCellsAlongLine(const double p1[3], const double p2[3], double tolerance, vtkIdList *cells) override
Given a finite line defined by the two points (p1,p2), return the list of unique cell ids in the buck...
vtkIdType FindCell(double pos[3], double vtkNotUsed, vtkGenericCell *cell, double pcoords[3], double *weights) override
Test a point to find if it is inside a cell.
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401
@ radius
Definition: vtkX3D.h:258
int vtkIdType
Definition: vtkType.h:338
#define VTK_ID_MAX
Definition: vtkType.h:342