VTK  9.1.0
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
44#include "vtkCommonDataModelModule.h" // For export macro
45
46// Forward declarations for PIMPL
47struct vtkCellBinner;
48struct vtkCellProcessor;
49
50class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
51{
52 friend struct vtkCellBinner;
53 friend struct vtkCellProcessor;
54
55public:
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(tol2), vtkGenericCell* cell,
84 double pcoords[3], 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
225
230 vtkSetMacro(UseDiagonalLengthTolerance, bool);
231 vtkGetMacro(UseDiagonalLengthTolerance, bool);
232 vtkBooleanMacro(UseDiagonalLengthTolerance, bool);
234
235protected:
238
239 double Bounds[6]; // Bounding box of the whole dataset
240 int Divisions[3]; // Number of sub-divisions in x-y-z directions
241 double H[3]; // Width of each bin in x-y-z directions
242
243 vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
244 bool LargeIds; // indicate whether integer ids are small or large
245 bool UseDiagonalLengthTolerance = false;
246
247 // Support PIMPLd implementation
248 vtkCellBinner* Binner; // Does the binning
249 vtkCellProcessor* Processor; // Invokes methods (templated subclasses)
250
251 // Support query operations
252 unsigned char* CellHasBeenVisited;
253 unsigned char QueryNumber;
254
255private:
257 void operator=(const vtkStaticCellLocator&) = delete;
258};
259
260#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:140
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate 3D points
Definition: vtkPoints.h:143
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
perform fast cell location operations
int IntersectWithLine(const double p1[3], const double p2[3], vtkPoints *points, vtkIdList *cellIds) override
Reimplemented from vtkAbstractCellLocator to support bad compilers.
static vtkStaticCellLocator * New()
Standard methods to instantiate, print and obtain type-related information.
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.
vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell *cell, double pcoords[3], double *weights) override
Test a point to find if it is inside a cell.
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
Satisfy vtkLocator abstract interface.
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
Standard methods to instantiate, print and obtain type-related information.
void GenerateRepresentation(int level, vtkPolyData *pd) override
Satisfy vtkLocator abstract interface.
void FreeSearchStructure() override
Satisfy vtkLocator abstract interface.
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...
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401
@ radius
Definition: vtkX3D.h:258
int vtkIdType
Definition: vtkType.h:332
#define VTK_ID_MAX
Definition: vtkType.h:336