VTK  9.6.20260527
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
59
60#ifndef vtkCellTreeLocator_h
61#define vtkCellTreeLocator_h
62
64#include "vtkCommonDataModelModule.h" // For export macro
65
66namespace detail
67{
68VTK_ABI_NAMESPACE_BEGIN
69// Forward declarations for PIMPL
70struct vtkCellTree;
71template <typename T>
72struct CellTree;
73template <typename T>
75VTK_ABI_NAMESPACE_END
76}
77
78VTK_ABI_NAMESPACE_BEGIN
79class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
80{
81 template <typename>
82 friend struct detail::CellTree;
83 template <typename>
85
86public:
88
92 void PrintSelf(ostream& os, vtkIndent indent) override;
94
100
102
107 vtkSetMacro(NumberOfBuckets, int);
108 vtkGetMacro(NumberOfBuckets, int);
110
118 bool GetLargeIds() { return this->LargeIds; }
119
120 // Reuse any superclass signatures that we don't override.
124
129 int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
130 double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
131
141 int IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkPoints* points,
142 vtkIdList* cellIds, vtkGenericCell* cell) override;
143
148 void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
149
155 vtkIdType FindCell(double pos[3], double tol2, vtkGenericCell* cell, int& subId,
156 double pcoords[3], double* weights) override;
157
159
162 void FreeSearchStructure() override;
163 void BuildLocator() override;
164 void ForceBuildLocator() override;
165 void GenerateRepresentation(int level, vtkPolyData* pd) override;
167
173 void ShallowCopy(vtkAbstractCellLocator* locator) override;
174
175protected:
178
179 void BuildLocatorInternal() override;
180
182 bool LargeIds = false;
183
184 detail::vtkCellTree* Tree;
185
186private:
187 vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
188 void operator=(const vtkCellTreeLocator&) = delete;
189};
190VTK_ABI_NAMESPACE_END
191
192#endif
vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.
void FindCellsAlongLine(const double p1[3], const double p2[3], double tol, vtkIdList *cells)
Take the passed line segment and intersect it with the data set.
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.
vtkAbstractCellLocator()
Find the cell containing a given point.
void FindCellsWithinBounds(double *bbox, vtkIdList *cells) override
Return a list of unique cell ids inside of a given bounding box.
vtkIdType FindCell(double pos[3], double tol2, vtkGenericCell *cell, int &subId, double pcoords[3], double *weights) override
Find the cell containing a given point.
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.
int IntersectWithLine(const double p1[3], const double p2[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 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.
bool GetLargeIds()
Inform the user as to whether large ids are being used.
~vtkCellTreeLocator() override
detail::vtkCellTree * Tree
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:135
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3D points
Definition vtkPoints.h:140
concrete dataset represents vertices, lines, polygons, and triangle strips
int vtkIdType
Definition vtkType.h:363