VTK  9.4.20241221
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
48namespace detail
49{
50VTK_ABI_NAMESPACE_BEGIN
51// Forward declarations for PIMPL
52struct vtkCellTree;
53template <typename T>
54struct CellTree;
55template <typename T>
57VTK_ABI_NAMESPACE_END
58}
59
60VTK_ABI_NAMESPACE_BEGIN
61class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
62{
63 template <typename>
64 friend struct detail::CellTree;
65 template <typename>
67
68public:
70
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76
82
84
89 vtkSetMacro(NumberOfBuckets, int);
90 vtkGetMacro(NumberOfBuckets, int);
92
100 bool GetLargeIds() { return this->LargeIds; }
101
102 // Re-use any superclass signatures that we don't override.
105
110 int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
111 double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
112
122 int IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkPoints* points,
123 vtkIdList* cellIds, vtkGenericCell* cell) override;
124
129 void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
130
140 const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
141 {
142 this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
143 }
144
150 vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell* cell, int& subId,
151 double pcoords[3], double* weights) override;
152
154
157 void FreeSearchStructure() override;
158 void BuildLocator() override;
159 void ForceBuildLocator() override;
160 void GenerateRepresentation(int level, vtkPolyData* pd) override;
162
168 void ShallowCopy(vtkAbstractCellLocator* locator) override;
169
170protected:
173
174 void BuildLocatorInternal() override;
175
177 bool LargeIds = false;
178
179 detail::vtkCellTree* Tree;
180
181private:
182 vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
183 void operator=(const vtkCellTreeLocator&) = delete;
184};
185VTK_ABI_NAMESPACE_END
186
187#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:133
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3D points
Definition vtkPoints.h:139
concrete dataset represents vertices, lines, polygons, and triangle strips
int vtkIdType
Definition vtkType.h:315