VTK  9.2.6
vtkCellTreeLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCellTreeLocator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
54 #ifndef vtkCellTreeLocator_h
55 #define vtkCellTreeLocator_h
56 
57 #include "vtkAbstractCellLocator.h"
58 #include "vtkCommonDataModelModule.h" // For export macro
59 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
60 
61 namespace detail
62 {
63 // Forward declarations for PIMPL
64 struct vtkCellTree;
65 template <typename T>
66 struct CellTree;
67 template <typename T>
69 }
70 
71 class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
72 {
73  template <typename>
74  friend struct detail::CellTree;
75  template <typename>
76  friend struct detail::CellTreeBuilder;
77 
78 public:
80 
84  void PrintSelf(ostream& os, vtkIndent indent) override;
86 
91  static vtkCellTreeLocator* New();
92 
94 
99  vtkSetMacro(NumberOfBuckets, int);
100  vtkGetMacro(NumberOfBuckets, int);
102 
110  bool GetLargeIds() { return this->LargeIds; }
111 
112  // Re-use any superclass signatures that we don't override.
115 
120  int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
121  double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
122 
132  int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints* points,
133  vtkIdList* cellIds, vtkGenericCell* cell) override;
134 
139  void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
140 
150  const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
151  {
152  this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
153  }
154 
160  vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell* cell, int& subId,
161  double pcoords[3], double* weights) override;
162 
164 
167  void FreeSearchStructure() override;
168  void BuildLocator() override;
169  void ForceBuildLocator() override;
170  void GenerateRepresentation(int level, vtkPolyData* pd) override;
172 
173  VTK_DEPRECATED_IN_9_2_0("This method is deprecated because LazyEvaluation has been deprecated")
174  virtual void BuildLocatorIfNeeded() {}
175 
179  void ShallowCopy(vtkAbstractCellLocator* locator) override;
180 
181 protected:
183  ~vtkCellTreeLocator() override;
184 
185  void BuildLocatorInternal() override;
186 
188  bool LargeIds = false;
189 
190  detail::vtkCellTree* Tree;
191 
192 private:
193  vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
194  void operator=(const vtkCellTreeLocator&) = delete;
195 };
196 
197 #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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:39
virtual void BuildLocatorInternal()
This function is not pure virtual to maintain backwards compatibility.
Definition: vtkLocator.h:203
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:33
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:39
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:167