VTK  9.0.1
vtkClosestPointStrategy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkClosestPointStrategy.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 =========================================================================*/
32 #ifndef vtkClosestPointStrategy_h
33 #define vtkClosestPointStrategy_h
34 
35 #include "vtkCell.h" //inline SelectCell
36 #include "vtkCommonDataModelModule.h" // For export macro
37 #include "vtkFindCellStrategy.h"
38 #include "vtkGenericCell.h" //inline SelectCell
39 #include "vtkPointSet.h" //inline SelectCell
40 
41 #include <set> // For tracking visited cells
42 
43 class vtkIdList;
45 
46 class VTKCOMMONDATAMODEL_EXPORT vtkClosestPointStrategy : public vtkFindCellStrategy
47 {
48 public:
52  static vtkClosestPointStrategy* New();
53 
55 
59  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
68  int Initialize(vtkPointSet* ps) override;
69 
74  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
75  double tol2, int& subId, double pcoords[3], double* weights) override;
76 
78 
84  virtual void SetPointLocator(vtkAbstractPointLocator*);
85  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
87 
91  vtkCell* SelectCell(vtkPointSet* self, vtkIdType cellId, vtkCell* cell, vtkGenericCell* gencell);
92 
93 protected:
95  ~vtkClosestPointStrategy() override;
96 
97  std::set<vtkIdType> VisitedCells;
102 
104  bool OwnsLocator; // was the locator specified? or taken from associated point set
105 
106 private:
108  void operator=(const vtkClosestPointStrategy&) = delete;
109 };
110 
111 // Handle cases where starting cell is provided or not
113  vtkPointSet* self, vtkIdType cellId, vtkCell* cell, vtkGenericCell* gencell)
114 {
115  if (!cell)
116  {
117  if (gencell)
118  {
119  self->GetCell(cellId, gencell);
120  cell = gencell;
121  }
122  else
123  {
124  cell = self->GetCell(cellId);
125  }
126  }
127  return cell;
128 }
129 
130 #endif
vtkPointSet.h
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkClosestPointStrategy::SelectCell
vtkCell * SelectCell(vtkPointSet *self, vtkIdType cellId, vtkCell *cell, vtkGenericCell *gencell)
Subclasses use this method to select the current cell.
Definition: vtkClosestPointStrategy.h:112
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkClosestPointStrategy::VisitedCells
std::set< vtkIdType > VisitedCells
Definition: vtkClosestPointStrategy.h:97
vtkFindCellStrategy
helper class to manage the vtkPointSet::FindCell() METHOD
Definition: vtkFindCellStrategy.h:51
vtkClosestPointStrategy::OwnsLocator
bool OwnsLocator
Definition: vtkClosestPointStrategy.h:104
vtkClosestPointStrategy::PointIds
vtkIdList * PointIds
Definition: vtkClosestPointStrategy.h:98
vtkCell.h
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkClosestPointStrategy
implement a specific vtkPointSet::FindCell() strategy based on closest point
Definition: vtkClosestPointStrategy.h:46
vtkFindCellStrategy::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkFindCellStrategy.h
vtkClosestPointStrategy::CellIds
vtkIdList * CellIds
Definition: vtkClosestPointStrategy.h:100
vtkPointSet
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:62
vtkFindCellStrategy::FindCell
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)=0
Virtual method for finding a cell.
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:38
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:36
vtkGenericCell.h
vtkClosestPointStrategy::PointLocator
vtkAbstractPointLocator * PointLocator
Definition: vtkClosestPointStrategy.h:103
vtkFindCellStrategy::Initialize
virtual int Initialize(vtkPointSet *ps)
All subclasses of this class must provide an initialize method.
vtkClosestPointStrategy::Neighbors
vtkIdList * Neighbors
Definition: vtkClosestPointStrategy.h:99
vtkClosestPointStrategy::NearPointIds
vtkIdList * NearPointIds
Definition: vtkClosestPointStrategy.h:101