VTK  9.5.20250910
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
190
191#include <unordered_set>
192
193VTK_ABI_NAMESPACE_BEGIN
195
196class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkCleanPolyData : public vtkPolyDataAlgorithm
197{
198public:
200 void PrintSelf(ostream& os, vtkIndent indent) override;
202
204
209 vtkSetMacro(ToleranceIsAbsolute, vtkTypeBool);
210 vtkBooleanMacro(ToleranceIsAbsolute, vtkTypeBool);
211 vtkGetMacro(ToleranceIsAbsolute, vtkTypeBool);
213
215
219 vtkSetClampMacro(Tolerance, double, 0.0, 1.0);
220 vtkGetMacro(Tolerance, double);
222
224
227 vtkSetClampMacro(AbsoluteTolerance, double, 0.0, VTK_DOUBLE_MAX);
228 vtkGetMacro(AbsoluteTolerance, double);
230
232
235 vtkSetMacro(ConvertLinesToPoints, vtkTypeBool);
236 vtkBooleanMacro(ConvertLinesToPoints, vtkTypeBool);
237 vtkGetMacro(ConvertLinesToPoints, vtkTypeBool);
239
241
244 vtkSetMacro(ConvertPolysToLines, vtkTypeBool);
245 vtkBooleanMacro(ConvertPolysToLines, vtkTypeBool);
246 vtkGetMacro(ConvertPolysToLines, vtkTypeBool);
248
250
253 vtkSetMacro(ConvertStripsToPolys, vtkTypeBool);
254 vtkBooleanMacro(ConvertStripsToPolys, vtkTypeBool);
255 vtkGetMacro(ConvertStripsToPolys, vtkTypeBool);
257
259
265 vtkSetMacro(PointMerging, vtkTypeBool);
266 vtkGetMacro(PointMerging, vtkTypeBool);
267 vtkBooleanMacro(PointMerging, vtkTypeBool);
269
271
276 vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
278
282 void CreateDefaultLocator(vtkPolyData* input = nullptr);
283
287 void ReleaseLocator() { this->SetLocator(nullptr); }
288
293
297 virtual void OperateOnPoint(double in[3], double out[3]);
298
302 virtual void OperateOnBounds(double in[6], double out[6]);
303
304 // This filter is difficult to stream.
305 // To get invariant results, the whole input must be processed at once.
306 // This flag allows the user to select whether strict piece invariance
307 // is required. By default it is on. When off, the filter can stream,
308 // but results may change.
309 vtkSetMacro(PieceInvariant, vtkTypeBool);
310 vtkGetMacro(PieceInvariant, vtkTypeBool);
311 vtkBooleanMacro(PieceInvariant, vtkTypeBool);
312
314
319 vtkSetMacro(OutputPointsPrecision, int);
320 vtkGetMacro(OutputPointsPrecision, int);
322
323protected:
326
327 // Usual data generation method
330
332 double Tolerance;
339
342
343private:
344 vtkCleanPolyData(const vtkCleanPolyData&) = delete;
345 void operator=(const vtkCleanPolyData&) = delete;
346
347 // Check whether a point is a primary point (as opposed to duplicated ghost point).
348 bool IsPrimaryPoint(vtkPolyData* input, vtkIdType ptIndex);
349 // Check whether a point's data has already been copied to the output.
350 bool IsPointDataAlreadyCopied(vtkIdType ptIndex);
351 // Insert point into newPts. If already present, only get its id.
352 void InsertUniquePoint(vtkIdTypeArray* globalIdsArray, vtkIdType ptIndex, vtkPoints* newPts,
353 std::unordered_map<vtkIdType, vtkIdType>& addedGlobalIdsMap, double* point, vtkIdType& ptId);
354
355 std::unordered_set<vtkIdType> CopiedPoints;
356};
357
358VTK_ABI_NAMESPACE_END
359#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:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_DOUBLE_MAX
Definition vtkType.h:171
#define VTK_MARSHALAUTO