VTK  9.3.20240419
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
61 #ifndef vtkCellTreeLocator_h
62 #define vtkCellTreeLocator_h
63 
64 #include "vtkAbstractCellLocator.h"
65 #include "vtkCommonDataModelModule.h" // For export macro
66 
67 namespace detail
68 {
69 VTK_ABI_NAMESPACE_BEGIN
70 // Forward declarations for PIMPL
71 struct vtkCellTree;
72 template <typename T>
73 struct CellTree;
74 template <typename T>
76 VTK_ABI_NAMESPACE_END
77 }
78 
79 VTK_ABI_NAMESPACE_BEGIN
80 class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
81 {
82  template <typename>
83  friend struct detail::CellTree;
84  template <typename>
85  friend struct detail::CellTreeBuilder;
86 
87 public:
89 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
101 
103 
108  vtkSetMacro(NumberOfBuckets, int);
109  vtkGetMacro(NumberOfBuckets, int);
111 
119  bool GetLargeIds() { return this->LargeIds; }
120 
121  // Re-use any superclass signatures that we don't override.
124 
129  int IntersectWithLine(const double a0[3], const double a1[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 
159  const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
160  {
161  this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
162  }
163 
169  vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell* cell, int& subId,
170  double pcoords[3], double* weights) override;
171 
173 
176  void FreeSearchStructure() override;
177  void BuildLocator() override;
178  void ForceBuildLocator() override;
179  void GenerateRepresentation(int level, vtkPolyData* pd) override;
181 
187  void ShallowCopy(vtkAbstractCellLocator* locator) override;
188 
189 protected:
192 
193  void BuildLocatorInternal() override;
194 
196  bool LargeIds = false;
197 
198  detail::vtkCellTree* Tree;
199 
200 private:
201  vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
202  void operator=(const vtkCellTreeLocator&) = delete;
203 };
204 VTK_ABI_NAMESPACE_END
205 
206 #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.
static vtkCellTreeLocator * New()
Constructor sets the maximum number of cells in a leaf to 8 and number of buckets to 6.
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.
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
Definition: vtkPolyData.h:181
@ points
Definition: vtkX3D.h:446
@ level
Definition: vtkX3D.h:395
int vtkIdType
Definition: vtkType.h:315