VTK  9.3.0
vtkCellTreeLocator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
42#ifndef vtkCellTreeLocator_h
43#define vtkCellTreeLocator_h
44
46#include "vtkCommonDataModelModule.h" // For export macro
47#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
48
49namespace detail
50{
51VTK_ABI_NAMESPACE_BEGIN
52// Forward declarations for PIMPL
53struct vtkCellTree;
54template <typename T>
55struct CellTree;
56template <typename T>
58VTK_ABI_NAMESPACE_END
59}
60
61VTK_ABI_NAMESPACE_BEGIN
62class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
63{
64 template <typename>
65 friend struct detail::CellTree;
66 template <typename>
68
69public:
71
75 void PrintSelf(ostream& os, vtkIndent indent) override;
77
83
85
90 vtkSetMacro(NumberOfBuckets, int);
91 vtkGetMacro(NumberOfBuckets, int);
93
101 bool GetLargeIds() { return this->LargeIds; }
102
103 // Re-use any superclass signatures that we don't override.
106
111 int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
112 double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
113
123 int IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkPoints* points,
124 vtkIdList* cellIds, vtkGenericCell* cell) override;
125
130 void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
131
141 const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
142 {
143 this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
144 }
145
151 vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell* cell, int& subId,
152 double pcoords[3], double* weights) override;
153
155
158 void FreeSearchStructure() override;
159 void BuildLocator() override;
160 void ForceBuildLocator() override;
161 void GenerateRepresentation(int level, vtkPolyData* pd) override;
163
164 VTK_DEPRECATED_IN_9_2_0("This method is deprecated because LazyEvaluation has been deprecated")
165 virtual void BuildLocatorIfNeeded() {}
166
170 void ShallowCopy(vtkAbstractCellLocator* locator) override;
171
172protected:
175
176 void BuildLocatorInternal() override;
177
179 bool LargeIds = false;
180
181 detail::vtkCellTree* Tree;
182
183private:
184 vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
185 void operator=(const vtkCellTreeLocator&) = delete;
186};
187VTK_ABI_NAMESPACE_END
188
189#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 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.
This class implements the data structures, construction algorithms for fast cell location.
void FindCellsWithinBounds(double *bbox, vtkIdList *cells) override
Return a list of unique cell ids inside of a given bounding box.
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.
int IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkPoints *points, vtkIdList *cellIds, vtkGenericCell *cell) override
Take the passed line segment and intersect it with the data set.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods to print and obtain type-related information.
void BuildLocatorInternal() override
This function is not pure virtual to maintain backwards compatibility.
void ForceBuildLocator() override
Satisfy vtkLocator abstract interface.
vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell *cell, int &subId, double pcoords[3], double *weights) override
Find the cell containing a given point.
bool GetLargeIds()
Inform the user as to whether large ids are being used.
~vtkCellTreeLocator() override
detail::vtkCellTree * Tree
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 FreeSearchStructure() override
Satisfy vtkLocator abstract interface.
void ShallowCopy(vtkAbstractCellLocator *locator) override
Shallow copy of a vtkCellTreeLocator.
void GenerateRepresentation(int level, vtkPolyData *pd) override
Satisfy vtkLocator abstract interface.
void BuildLocator() override
Satisfy vtkLocator abstract interface.
static vtkCellTreeLocator * New()
Constructor sets the maximum number of cells in a leaf to 8 and number of buckets to 6.
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:23
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate 3D points
Definition vtkPoints.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition vtkType.h:315