VTK  9.3.1
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 
45 #include "vtkAbstractCellLocator.h"
46 #include "vtkCommonDataModelModule.h" // For export macro
47 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
48 
49 namespace detail
50 {
51 VTK_ABI_NAMESPACE_BEGIN
52 // Forward declarations for PIMPL
53 struct vtkCellTree;
54 template <typename T>
55 struct CellTree;
56 template <typename T>
58 VTK_ABI_NAMESPACE_END
59 }
60 
61 VTK_ABI_NAMESPACE_BEGIN
62 class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
63 {
64  template <typename>
65  friend struct detail::CellTree;
66  template <typename>
67  friend struct detail::CellTreeBuilder;
68 
69 public:
71 
75  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
82  static vtkCellTreeLocator* New();
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 
172 protected:
174  ~vtkCellTreeLocator() override;
175 
176  void BuildLocatorInternal() override;
177 
179  bool LargeIds = false;
180 
181  detail::vtkCellTree* Tree;
182 
183 private:
184  vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
185  void operator=(const vtkCellTreeLocator&) = delete;
186 };
187 VTK_ABI_NAMESPACE_END
188 
189 #endif
virtual void BuildLocator()=0
Build the locator from the input dataset.
virtual void FindCellsWithinBounds(double *bbox, vtkIdList *cells)
Return a list of unique cell ids inside of a given bounding box.
#define VTK_DEPRECATED_IN_9_2_0(reason)
an abstract base class for locators which find cells
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
provides thread-safe access to cells
detail::vtkCellTree * Tree
virtual void ShallowCopy(vtkAbstractCellLocator *)
Shallow copy of a vtkAbstractCellLocator.
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.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void BuildLocatorInternal()
This function is not pure virtual to maintain backwards compatibility.
Definition: vtkLocator.h:192
virtual vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.
list of point or cell ids
Definition: vtkIdList.h:22
bool GetLargeIds()
Inform the user as to whether large ids are being used.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
This class implements the data structures, construction algorithms for fast cell location.
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
represent and manipulate 3D points
Definition: vtkPoints.h:28
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:156