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 
104  void FindCellsAlongLine(const double p1[3], const double p2[3],
105  double tolerance, vtkIdList *cells) override;
106 
111  int IntersectWithLine(const double a0[3], const double a1[3], double tol,
112  double& t, double x[3], double pcoords[3],
113  int &subId, vtkIdType &cellId,
114  vtkGenericCell *cell) override;
115 
119  int IntersectWithLine(const double p1[3], const double p2[3], double tol,
120  double& t, double x[3], double pcoords[3], int &subId) override
121  {
122  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId);
123  }
124 
128  int IntersectWithLine(const double p1[3], const double p2[3], double tol,
129  double &t, double x[3], double pcoords[3],
130  int &subId, vtkIdType &cellId) override
131  {
132  return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId, cellId);
133  }
134 
138  int IntersectWithLine(const double p1[3], const double p2[3],
139  vtkPoints *points, vtkIdList *cellIds) override
140  {
141  return this->Superclass::IntersectWithLine(p1, p2, points, cellIds);
142  }
143 
145 
148  void GenerateRepresentation(int level, vtkPolyData *pd) override;
149  void FreeSearchStructure() override;
150  void BuildLocator() override;
152 
154 
168  vtkSetClampMacro(MaxNumberOfBuckets,vtkIdType,1000,VTK_ID_MAX);
169  vtkGetMacro(MaxNumberOfBuckets,vtkIdType);
171 
179  bool GetLargeIds() {return this->LargeIds;}
180 
181 protected:
183  ~vtkStaticCellLocator() override;
184 
185  double Bounds[6]; // Bounding box of the whole dataset
186  int Divisions[3]; // Number of sub-divisions in x-y-z directions
187  double H[3]; // Width of each bin in x-y-z directions
188 
189  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
190  bool LargeIds; //indicate whether integer ids are small or large
191 
192  // Support PIMPLd implementation
193  vtkCellBinner *Binner; // Does the binning
194  vtkCellProcessor *Processor; // Invokes methods (templated subclasses)
195 
196  // Support query operations
197  unsigned char *CellHasBeenVisited;
198  unsigned char QueryNumber;
199 
200 private:
202  void operator=(const vtkStaticCellLocator&) = delete;
203 };
204 
205 #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:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
unsigned char * CellHasBeenVisited
provides thread-safe access to cells
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.
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 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.
#define VTK_ID_MAX
Definition: vtkType.h:351
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void FindCellsAlongLine(const double p1[3], const double p2[3], double tolerance, vtkIdList *cells)
Given a finite line defined by the two points (p1,p2), return the list of unique cell ids in the buck...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
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.
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