VTK  9.4.20250129
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
184#ifndef vtkCleanPolyData_h
185#define vtkCleanPolyData_h
186
187#include "vtkFiltersCoreModule.h" // For export macro
188#include "vtkPolyDataAlgorithm.h"
189
190#include <unordered_set>
191
192VTK_ABI_NAMESPACE_BEGIN
194
195class VTKFILTERSCORE_EXPORT vtkCleanPolyData : public vtkPolyDataAlgorithm
196{
197public:
199 void PrintSelf(ostream& os, vtkIndent indent) override;
201
203
208 vtkSetMacro(ToleranceIsAbsolute, vtkTypeBool);
209 vtkBooleanMacro(ToleranceIsAbsolute, vtkTypeBool);
210 vtkGetMacro(ToleranceIsAbsolute, vtkTypeBool);
212
214
218 vtkSetClampMacro(Tolerance, double, 0.0, 1.0);
219 vtkGetMacro(Tolerance, double);
221
223
226 vtkSetClampMacro(AbsoluteTolerance, double, 0.0, VTK_DOUBLE_MAX);
227 vtkGetMacro(AbsoluteTolerance, double);
229
231
234 vtkSetMacro(ConvertLinesToPoints, vtkTypeBool);
235 vtkBooleanMacro(ConvertLinesToPoints, vtkTypeBool);
236 vtkGetMacro(ConvertLinesToPoints, vtkTypeBool);
238
240
243 vtkSetMacro(ConvertPolysToLines, vtkTypeBool);
244 vtkBooleanMacro(ConvertPolysToLines, vtkTypeBool);
245 vtkGetMacro(ConvertPolysToLines, vtkTypeBool);
247
249
252 vtkSetMacro(ConvertStripsToPolys, vtkTypeBool);
253 vtkBooleanMacro(ConvertStripsToPolys, vtkTypeBool);
254 vtkGetMacro(ConvertStripsToPolys, vtkTypeBool);
256
258
264 vtkSetMacro(PointMerging, vtkTypeBool);
265 vtkGetMacro(PointMerging, vtkTypeBool);
266 vtkBooleanMacro(PointMerging, vtkTypeBool);
268
270
275 vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
277
281 void CreateDefaultLocator(vtkPolyData* input = nullptr);
282
286 void ReleaseLocator() { this->SetLocator(nullptr); }
287
292
296 virtual void OperateOnPoint(double in[3], double out[3]);
297
301 virtual void OperateOnBounds(double in[6], double out[6]);
302
303 // This filter is difficult to stream.
304 // To get invariant results, the whole input must be processed at once.
305 // This flag allows the user to select whether strict piece invariance
306 // is required. By default it is on. When off, the filter can stream,
307 // but results may change.
308 vtkSetMacro(PieceInvariant, vtkTypeBool);
309 vtkGetMacro(PieceInvariant, vtkTypeBool);
310 vtkBooleanMacro(PieceInvariant, vtkTypeBool);
311
313
318 vtkSetMacro(OutputPointsPrecision, int);
319 vtkGetMacro(OutputPointsPrecision, int);
321
322protected:
325
326 // Usual data generation method
329
331 double Tolerance;
338
341
342private:
343 vtkCleanPolyData(const vtkCleanPolyData&) = delete;
344 void operator=(const vtkCleanPolyData&) = delete;
345
346 // Check whether a point is a primary point (as opposed to duplicated ghost point).
347 bool IsPrimaryPoint(vtkPolyData* input, vtkIdType ptIndex);
348 // Check whether a point's data has already been copied to the output.
349 bool IsPointDataAlreadyCopied(vtkIdType ptIndex);
350 // Insert point into newPts. If already present, only get its id.
351 void InsertUniquePoint(vtkIdTypeArray* globalIdsArray, vtkIdType ptIndex, vtkPoints* newPts,
352 std::unordered_map<vtkIdType, vtkIdType>& addedGlobalIdsMap, double* point, vtkIdType& ptId);
353
354 std::unordered_set<vtkIdType> CopiedPoints;
355};
356
357VTK_ABI_NAMESPACE_END
358#endif
merge duplicate points, and/or remove unused points and/or remove degenerate cells
virtual void OperateOnPoint(double in[3], double out[3])
Perform operation on a point.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ReleaseLocator()
Release locator.
virtual void OperateOnBounds(double in[6], double out[6])
Perform operation on bounds.
vtkTypeBool PointMerging
vtkTypeBool ConvertPolysToLines
vtkMTimeType GetMTime() override
Get the MTime of this object also considering the locator.
vtkTypeBool ConvertLinesToPoints
static vtkCleanPolyData * New()
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
~vtkCleanPolyData() override
void CreateDefaultLocator(vtkPolyData *input=nullptr)
Create default locator.
virtual void SetLocator(vtkIncrementalPointLocator *locator)
Set/Get a spatial locator for speeding the search process.
vtkIncrementalPointLocator * Locator
vtkTypeBool ConvertStripsToPolys
vtkTypeBool ToleranceIsAbsolute
vtkTypeBool PieceInvariant
dynamic, self-adjusting array of vtkIdType
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:139
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_DOUBLE_MAX
Definition vtkType.h:154