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 
60  static vtkStaticCellLocator* New();
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 
105  void FindCellsAlongLine(
106  const double p1[3], const double p2[3], double tolerance, vtkIdList* cells) override;
107 
109 
116  void FindCellsAlongPlane(
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:
226  ~vtkStaticCellLocator() override;
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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkAbstractCellLocator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractCellLocator::FindCellsAlongLine
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...
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkStaticCellLocator::Binner
vtkCellBinner * Binner
Definition: vtkStaticCellLocator.h:236
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkAbstractCellLocator.h
vtkAbstractCellLocator::FindCell
virtual vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.
vtkStaticCellLocator::IntersectWithLine
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.
Definition: vtkStaticCellLocator.h:163
vtkAbstractCellLocator::FindClosestPointWithinRadius
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.
vtkStaticCellLocator::Processor
vtkCellProcessor * Processor
Definition: vtkStaticCellLocator.h:237
vtkStaticCellLocator::LargeIds
bool LargeIds
Definition: vtkStaticCellLocator.h:233
vtkAbstractCellLocator::FindCellsWithinBounds
virtual void FindCellsWithinBounds(double *bbox, vtkIdList *cells)
Return a list of unique cell ids inside of a given bounding box.
vtkStaticCellLocator::GetLargeIds
bool GetLargeIds()
Inform the user as to whether large ids are being used.
Definition: vtkStaticCellLocator.h:222
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkStaticCellLocator::CellHasBeenVisited
unsigned char * CellHasBeenVisited
Definition: vtkStaticCellLocator.h:240
vtkLocator::GenerateRepresentation
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkStaticCellLocator::FindCell
vtkIdType FindCell(double x[3]) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
Definition: vtkStaticCellLocator.h:89
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkLocator::BuildLocator
virtual void BuildLocator()=0
Build the locator from the input dataset.
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:48
vtkStaticCellLocator::IntersectWithLine
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.
Definition: vtkStaticCellLocator.h:172
vtkStaticCellLocator::MaxNumberOfBuckets
vtkIdType MaxNumberOfBuckets
Definition: vtkStaticCellLocator.h:232
vtkAbstractCellLocator::FindClosestPoint
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.
vtkAbstractCellLocator::IntersectWithLine
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.
vtkStaticCellLocator::IntersectWithLine
int IntersectWithLine(const double p1[3], const double p2[3], vtkPoints *points, vtkIdList *cellIds) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
Definition: vtkStaticCellLocator.h:181
VTK_ID_MAX
#define VTK_ID_MAX
Definition: vtkType.h:342
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:36
vtkLocator::FreeSearchStructure
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
vtkX3D::radius
@ radius
Definition: vtkX3D.h:258
vtkStaticCellLocator
perform fast cell location operations
Definition: vtkStaticCellLocator.h:50
vtkStaticCellLocator::QueryNumber
unsigned char QueryNumber
Definition: vtkStaticCellLocator.h:241