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 =========================================================================*/
73 #ifndef vtkCellTreeLocator_h
74 #define vtkCellTreeLocator_h
75 
76 #include "vtkAbstractCellLocator.h"
77 #include "vtkCommonDataModelModule.h" // For export macro
78 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
79 
80 namespace detail
81 {
82 // Forward declarations for PIMPL
83 struct vtkCellTree;
84 template <typename T>
85 struct CellTree;
86 template <typename T>
88 }
89 
90 class VTKCOMMONDATAMODEL_EXPORT vtkCellTreeLocator : public vtkAbstractCellLocator
91 {
92  template <typename>
93  friend struct detail::CellTree;
94  template <typename>
95  friend struct detail::CellTreeBuilder;
96 
97 public:
99 
103  void PrintSelf(ostream& os, vtkIndent indent) override;
105 
111 
113 
118  vtkSetMacro(NumberOfBuckets, int);
119  vtkGetMacro(NumberOfBuckets, int);
121 
129  bool GetLargeIds() { return this->LargeIds; }
130 
131  // Re-use any superclass signatures that we don't override.
134 
139  int IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t, double x[3],
140  double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell* cell) override;
141 
151  int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints* points,
152  vtkIdList* cellIds, vtkGenericCell* cell) override;
153 
158  void FindCellsWithinBounds(double* bbox, vtkIdList* cells) override;
159 
169  const double p1[3], const double p2[3], double tolerance, vtkIdList* cellsIds) override
170  {
171  this->Superclass::FindCellsAlongLine(p1, p2, tolerance, cellsIds);
172  }
173 
179  vtkIdType FindCell(double pos[3], double vtkNotUsed(tol2), vtkGenericCell* cell, int& subId,
180  double pcoords[3], double* weights) override;
181 
183 
186  void FreeSearchStructure() override;
187  void BuildLocator() override;
188  void ForceBuildLocator() override;
189  void GenerateRepresentation(int level, vtkPolyData* pd) override;
191 
192  VTK_DEPRECATED_IN_9_2_0("This method is deprecated because LazyEvaluation has been deprecated")
193  virtual void BuildLocatorIfNeeded() {}
194 
198  void ShallowCopy(vtkAbstractCellLocator* locator) override;
199 
200 protected:
203 
204  void BuildLocatorInternal() override;
205 
207  bool LargeIds = false;
208 
209  detail::vtkCellTree* Tree;
210 
211 private:
212  vtkCellTreeLocator(const vtkCellTreeLocator&) = delete;
213  void operator=(const vtkCellTreeLocator&) = delete;
214 };
215 
216 #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.
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
int IntersectWithLine(const double p1[3], const double p2[3], const double tol, vtkPoints *points, vtkIdList *cellIds, vtkGenericCell *cell) override
Take the passed line segment and intersect it with the data set.
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:143
a simple class to control print indentation
Definition: vtkIndent.h:119
represent and manipulate 3D points
Definition: vtkPoints.h:149
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
@ points
Definition: vtkX3D.h:452
@ level
Definition: vtkX3D.h:401
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:332