VTK  9.7.1
vtkCleanPolyData.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
75 #ifndef vtkCleanPolyData_h
76 #define vtkCleanPolyData_h
77 
78 #include "vtkFiltersCoreModule.h" // For export macro
79 #include "vtkPolyDataAlgorithm.h"
80 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
81 
82 #include <unordered_set>
83 
84 VTK_ABI_NAMESPACE_BEGIN
86 
87 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkCleanPolyData : public vtkPolyDataAlgorithm
88 {
89 public:
90  static vtkCleanPolyData* New();
91  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
95 
100  vtkSetMacro(ToleranceIsAbsolute, vtkTypeBool);
101  vtkBooleanMacro(ToleranceIsAbsolute, vtkTypeBool);
102  vtkGetMacro(ToleranceIsAbsolute, vtkTypeBool);
104 
106 
110  vtkSetClampMacro(Tolerance, double, 0.0, 1.0);
111  vtkGetMacro(Tolerance, double);
113 
115 
118  vtkSetClampMacro(AbsoluteTolerance, double, 0.0, VTK_DOUBLE_MAX);
119  vtkGetMacro(AbsoluteTolerance, double);
121 
123 
126  vtkSetMacro(ConvertLinesToPoints, vtkTypeBool);
127  vtkBooleanMacro(ConvertLinesToPoints, vtkTypeBool);
128  vtkGetMacro(ConvertLinesToPoints, vtkTypeBool);
130 
132 
135  vtkSetMacro(ConvertPolysToLines, vtkTypeBool);
136  vtkBooleanMacro(ConvertPolysToLines, vtkTypeBool);
137  vtkGetMacro(ConvertPolysToLines, vtkTypeBool);
139 
141 
144  vtkSetMacro(ConvertStripsToPolys, vtkTypeBool);
145  vtkBooleanMacro(ConvertStripsToPolys, vtkTypeBool);
146  vtkGetMacro(ConvertStripsToPolys, vtkTypeBool);
148 
150 
156  vtkSetMacro(PointMerging, vtkTypeBool);
157  vtkGetMacro(PointMerging, vtkTypeBool);
158  vtkBooleanMacro(PointMerging, vtkTypeBool);
160 
162 
166  virtual void SetLocator(vtkIncrementalPointLocator* locator);
167  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
169 
173  void CreateDefaultLocator(vtkPolyData* input = nullptr);
174 
178  void ReleaseLocator() { this->SetLocator(nullptr); }
179 
183  vtkMTimeType GetMTime() override;
184 
188  virtual void OperateOnPoint(double in[3], double out[3]);
189 
193  virtual void OperateOnBounds(double in[6], double out[6]);
194 
195  // This filter is difficult to stream.
196  // To get invariant results, the whole input must be processed at once.
197  // This flag allows the user to select whether strict piece invariance
198  // is required. By default it is on. When off, the filter can stream,
199  // but results may change.
200  vtkSetMacro(PieceInvariant, vtkTypeBool);
201  vtkGetMacro(PieceInvariant, vtkTypeBool);
202  vtkBooleanMacro(PieceInvariant, vtkTypeBool);
203 
205 
210  vtkSetMacro(OutputPointsPrecision, int);
211  vtkGetMacro(OutputPointsPrecision, int);
213 
214 protected:
216  ~vtkCleanPolyData() override;
217 
218  // Usual data generation method
221 
223  double Tolerance;
230 
233 
234 private:
235  vtkCleanPolyData(const vtkCleanPolyData&) = delete;
236  void operator=(const vtkCleanPolyData&) = delete;
237 
238  // Check whether a point's data has already been copied to the output.
239  bool IsPointDataAlreadyCopied(vtkIdType ptIndex);
240  // Insert point into newPts. If already present, only get its id.
241  void InsertUniquePoint(vtkIdTypeArray* globalIdsArray, vtkIdType ptIndex, vtkPoints* newPts,
242  std::unordered_map<vtkIdType, vtkIdType>& addedGlobalIdsMap, double* point, vtkIdType& ptId);
243 
244  std::unordered_set<vtkIdType> CopiedPoints;
245 };
246 
247 VTK_ABI_NAMESPACE_END
248 #endif
vtkTypeBool ConvertLinesToPoints
#define VTK_DOUBLE_MAX
Definition: vtkType.h:202
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
vtkTypeBool ToleranceIsAbsolute
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkTypeBool ConvertPolysToLines
vtkTypeBool ConvertStripsToPolys
Abstract class in support of both point location and point insertion.
vtkTypeBool PieceInvariant
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
merge duplicate points, and/or remove unused points and/or remove degenerate cells ...
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkTypeBool PointMerging
void ReleaseLocator()
Release locator.
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
represent and manipulate 3D points
Definition: vtkPoints.h:30
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIncrementalPointLocator * Locator