VTK  9.7.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
41 #ifndef vtkCellTreeLocator_h
42 #define vtkCellTreeLocator_h
43 
44 #include "vtkAbstractCellLocator.h"
45 #include "vtkCommonDataModelModule.h" // For export macro
46 
47 namespace detail
48 {
49 VTK_ABI_NAMESPACE_BEGIN
50 // Forward declarations for PIMPL
51 struct vtkCellTree;
52 template <typename T>
53 struct CellTree;
54 template <typename T>
56 VTK_ABI_NAMESPACE_END
57 }
58 
59 VTK_ABI_NAMESPACE_BEGIN
60 class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
61 {
62  template <typename>
63  friend struct detail::CellTree;
64  template <typename>
65  friend struct detail::CellTreeBuilder;
66 
67 public:
69 
73  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
80  static vtkCellTreeLocator* New();
81 
83 
88  vtkSetMacro(NumberOfBuckets, int);
89  vtkGetMacro(NumberOfBuckets, int);
91 
99  bool GetLargeIds() { return this->LargeIds; }
100 
101  // Reuse any superclass signatures that we don't override.
105 
110  int IntersectWithLine(const double p1[3], const double p2[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 
136  vtkIdType FindCell(double pos[3], double tol2, vtkGenericCell* cell, int& subId,
137  double pcoords[3], double* weights) override;
138 
140 
143  void FreeSearchStructure() override;
144  void BuildLocator() override;
145  void ForceBuildLocator() override;
146  void GenerateRepresentation(int level, vtkPolyData* pd) override;
148 
154  void ShallowCopy(vtkAbstractCellLocator* locator) override;
155 
156 protected:
158  ~vtkCellTreeLocator() override;
159 
160  void BuildLocatorInternal() override;
161 
163  bool LargeIds = false;
164 
165  detail::vtkCellTree* Tree;
166 
167 private:
168  vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
169  void operator=(const vtkCellTreeLocator&) = delete;
170 };
171 VTK_ABI_NAMESPACE_END
172 
173 #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.
an abstract base class for locators which find cells
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
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:199
list of point or cell ids
Definition: vtkIdList.h:25
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.
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.
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 void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
represent and manipulate 3D points
Definition: vtkPoints.h:30
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:163
vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.