VTK  9.2.6
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=========================================================================*/
49#ifndef vtkStaticCellLocator_h
50#define vtkStaticCellLocator_h
51
53#include "vtkCommonDataModelModule.h" // For export macro
54#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
55
56// Forward declarations for PIMPL
57struct vtkCellBinner;
58struct vtkCellProcessor;
59
60class VTKCOMMONDATAMODEL_EXPORT vtkStaticCellLocator : public vtkAbstractCellLocator
61{
62 friend struct vtkCellBinner;
63 friend struct vtkCellProcessor;
64
65public:
67
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
76
82 vtkSetVector3Macro(Divisions, int);
83 vtkGetVectorMacro(Divisions, int, 3);
85
87
101 vtkSetClampMacro(MaxNumberOfBuckets, vtkIdType, 1000, VTK_ID_MAX);
102 vtkGetMacro(MaxNumberOfBuckets, vtkIdType);
104
112 bool GetLargeIds() { return this->LargeIds; }
113
115
126 VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
127 vtkSetMacro(UseDiagonalLengthTolerance, bool);
128 VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
129 vtkGetMacro(UseDiagonalLengthTolerance, bool);
130 VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
131 virtual void UseDiagonalLengthToleranceOn()
132 {
133 if (this->UseDiagonalLengthTolerance != true)
134 {
135 this->UseDiagonalLengthTolerance = true;
136 this->Modified();
137 }
138 }
139 VTK_DEPRECATED_IN_9_2_0("This method is no longer used because Tolerance is also not used")
140 virtual void UseDiagonalLengthToleranceOff()
141 {
142 if (this->UseDiagonalLengthTolerance != false)
143 {
144 this->UseDiagonalLengthTolerance = false;
145 this->Modified();
146 }
147 }
149
150 // Re-use any superclass signatures that we don't override.
155
162 int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
163 double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
164
174 int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints* points,
175 vtkIdList* cellIds, vtkGenericCell* cell) override;
176
186 void FindClosestPoint(const double x[3], double closestPoint[3], vtkGenericCell* cell,
187 vtkIdType& cellId, int& subId, double& dist2) override
188 {
189 this->Superclass::FindClosestPoint(x, closestPoint, cell, cellId, subId, dist2);
190 }
191
202 vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
203 vtkGenericCell* cell, vtkIdType& cellId, int& subId, double& dist2, int& inside) override;
204
209 void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
210
220 const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
221 {
222 this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
223 }
224
232 const double o[3], const double n[3], double tolerance, vtkIdList* cells) override;
233
241 vtkIdType FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell* GenCell, int& subId,
242 double pcoords[3], double* weights) override;
243
248 bool InsideCellBounds(double x[3], vtkIdType cellId) override;
249
251
254 void GenerateRepresentation(int level, vtkPolyData* pd) override;
255 void FreeSearchStructure() override;
256 void BuildLocator() override;
257 void ForceBuildLocator() override;
259
263 void ShallowCopy(vtkAbstractCellLocator* locator) override;
264
265protected:
268
269 void BuildLocatorInternal() override;
270
271 double Bounds[6]; // Bounding box of the whole dataset
272 int Divisions[3]; // Number of sub-divisions in x-y-z directions
273 double H[3]; // Width of each bin in x-y-z directions
274
275 vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
276 bool LargeIds; // indicate whether integer ids are small or large
277
278 // VTK_DEPRECATED_IN_9_2_0 This attribute needs to be removed
279 bool UseDiagonalLengthTolerance = false;
280
281 // Support PIMPLd implementation
282 vtkCellBinner* Binner; // Does the binning
283 vtkCellProcessor* Processor; // Invokes methods (templated subclasses)
284
285private:
287 void operator=(const vtkStaticCellLocator&) = delete;
288};
289
290#endif
an abstract base class for locators which find cells
virtual vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.
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.
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.
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
virtual void Modified()
Update the modification time for this object.
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.
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.
void FindCellsAlongLine(const double p1[3], const double p2[3], double tolerance, vtkIdList *cellsIds) override
Take the passed line segment and intersect it with the data set.
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.
void FindCellsAlongPlane(const double o[3], const double n[3], double tolerance, vtkIdList *cells) override
Take the passed line segment and intersect it with the data set.
void ShallowCopy(vtkAbstractCellLocator *locator) override
Shallow copy of a vtkStaticCellLocator.
int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints *points, vtkIdList *cellIds, vtkGenericCell *cell) override
Take the passed line segment and intersect it with the data set.
void BuildLocator() override
Satisfy vtkLocator abstract interface.
vtkIdType FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell *GenCell, int &subId, double pcoords[3], double *weights) override
Find the cell containing a given point.
bool InsideCellBounds(double x[3], vtkIdType cellId) override
Quickly test if a point is inside the bounds of a particular cell.
~vtkStaticCellLocator() override
vtkCellProcessor * Processor
bool GetLargeIds()
Inform the user as to whether large ids are being used.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to instantiate, print and obtain type-related information.
void BuildLocatorInternal() override
This function is not pure virtual to maintain backwards compatibility.
void GenerateRepresentation(int level, vtkPolyData *pd) override
Satisfy vtkLocator abstract interface.
void FreeSearchStructure() override
Satisfy vtkLocator abstract interface.
void ForceBuildLocator() 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.
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition vtkType.h:332
#define VTK_ID_MAX
Definition vtkType.h:336