VTK
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 =========================================================================*/
41 #ifndef vtkStaticCellLocator_h
42 #define vtkStaticCellLocator_h
43 
44 #include "vtkCommonDataModelModule.h" // For export macro
45 #include "vtkAbstractCellLocator.h"
46 
47 
48 // Forward declarations for PIMPL
49 struct vtkCellBinner;
50 struct vtkCellProcessor;
51 
52 class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
53 {
54 friend struct vtkCellBinner;
55 friend struct vtkCellProcessor;
56 public:
58 
61  static vtkStaticCellLocator *New();
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
73  vtkSetVector3Macro(Divisions,int);
74  vtkGetVectorMacro(Divisions,int,3);
76 
81  vtkIdType FindCell(double pos[3], double vtkNotUsed, vtkGenericCell *cell,
82  double pcoords[3], double* weights ) override;
83 
87  vtkIdType FindCell(double x[3]) override
88  { return this->Superclass::FindCell(x); }
89 
95  void FindCellsWithinBounds(double *bbox, vtkIdList *cells) override;
96 
101  int IntersectWithLine(double a0[3], double a1[3], double tol,
102  double& t, double x[3], double pcoords[3],
103  int &subId, vtkIdType &cellId,
104  vtkGenericCell *cell) override;
105 
109  int IntersectWithLine(double p1[3], double p2[3], double tol,
110  double& t, double x[3], double pcoords[3], int &subId) override
111  {
112  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId);
113  }
114 
118  int IntersectWithLine(double p1[3], double p2[3], double tol,
119  double &t, double x[3], double pcoords[3],
120  int &subId, vtkIdType &cellId) override
121  {
122  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId, cellId);
123  }
124 
128  int IntersectWithLine(const double p1[3], const double p2[3],
129  vtkPoints *points, vtkIdList *cellIds) override
130  {
131  return this->Superclass::IntersectWithLine(p1, p2, points, cellIds);
132  }
133 
135 
138  void GenerateRepresentation(int level, vtkPolyData *pd) override;
139  void FreeSearchStructure() override;
140  void BuildLocator() override;
142 
144 
158  vtkSetClampMacro(MaxNumberOfBuckets,vtkIdType,1000,VTK_ID_MAX);
159  vtkGetMacro(MaxNumberOfBuckets,vtkIdType);
161 
169  bool GetLargeIds() {return this->LargeIds;}
170 
171 protected:
173  ~vtkStaticCellLocator() override;
174 
175  double Bounds[6]; // Bounding box of the whole dataset
176  int Divisions[3]; // Number of sub-divisions in x-y-z directions
177  double H[3]; // Width of each bin in x-y-z directions
178 
179  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
180  bool LargeIds; //indicate whether integer ids are small or large
181 
182  // Support PIMPLd implementation
183  vtkCellBinner *Binner; // Does the binning
184  vtkCellProcessor *Processor; // Invokes methods (templated subclasses)
185 
186  // Support query operations
187  unsigned char *CellHasBeenVisited;
188  unsigned char QueryNumber;
189 
190 private:
192  void operator=(const vtkStaticCellLocator&) = delete;
193 };
194 
195 #endif
virtual void BuildLocator()=0
Build the locator from the input dataset.
virtual void FindCellsWithinBounds(double *bbox, vtkIdList *cells)
Return a list of unique cell ids inside of a given bounding box.
vtkIdType FindCell(double x[3]) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
an abstract base class for locators which find cells
int IntersectWithLine(const double p1[3], const double p2[3], vtkPoints *points, vtkIdList *cellIds) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
perform fast cell location operations
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
int IntersectWithLine(double p1[3], 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.
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
unsigned char * CellHasBeenVisited
provides thread-safe access to cells
a simple class to control print indentation
Definition: vtkIndent.h:39
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:36
vtkCellProcessor * Processor
bool GetLargeIds()
Inform the user as to whether large ids are being used.
virtual int IntersectWithLine(double p1[3], 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.
#define VTK_ID_MAX
Definition: vtkType.h:349
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
int IntersectWithLine(double p1[3], double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
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