VTK  9.6.1
vtkQuadricDecimation.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
47
48#ifndef vtkQuadricDecimation_h
49#define vtkQuadricDecimation_h
50
51#include "vtkFiltersCoreModule.h" // For export macro
53#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
54
55VTK_ABI_NAMESPACE_BEGIN
56class vtkEdgeTable;
57class vtkIdList;
58class vtkPointData;
60class vtkDoubleArray;
61
62class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkQuadricDecimation : public vtkPolyDataAlgorithm
63{
64public:
66 void PrintSelf(ostream& os, vtkIndent indent) override;
68
70
76 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
77 vtkGetMacro(TargetReduction, double);
79
81
90
92
103
105
110 vtkSetMacro(MaximumError, double);
111 vtkGetMacro(MaximumError, double);
113
115
130 vtkSetMacro(Regularize, vtkTypeBool);
131 vtkGetMacro(Regularize, vtkTypeBool);
132 vtkBooleanMacro(Regularize, vtkTypeBool);
133 vtkSetMacro(Regularization, double);
134 vtkGetMacro(Regularization, double);
136
138
149 vtkSetMacro(BoundaryWeightFactor, double);
150 vtkGetMacro(BoundaryWeightFactor, double);
152
154
159 vtkGetMacro(MapPointData, bool);
160 vtkSetMacro(MapPointData, bool);
161 vtkBooleanMacro(MapPointData, bool);
163
165
173 vtkBooleanMacro(ScalarsAttribute, vtkTypeBool);
176 vtkBooleanMacro(VectorsAttribute, vtkTypeBool);
179 vtkBooleanMacro(NormalsAttribute, vtkTypeBool);
182 vtkBooleanMacro(TCoordsAttribute, vtkTypeBool);
185 vtkBooleanMacro(TensorsAttribute, vtkTypeBool);
187
189
194 vtkSetMacro(ScalarsWeight, double);
195 vtkSetMacro(VectorsWeight, double);
196 vtkSetMacro(NormalsWeight, double);
197 vtkSetMacro(TCoordsWeight, double);
198 vtkSetMacro(TensorsWeight, double);
199 vtkGetMacro(ScalarsWeight, double);
200 vtkGetMacro(VectorsWeight, double);
201 vtkGetMacro(NormalsWeight, double);
202 vtkGetMacro(TCoordsWeight, double);
203 vtkGetMacro(TensorsWeight, double);
205
207
211 vtkGetMacro(ActualReduction, double);
213
214protected:
217
219
225
230
235
240
245 void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
246
248
252 double ComputeCost(vtkIdType edgeId, double* x);
253 double ComputeCost2(vtkIdType edgeId, double* x);
255
262
267
268 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double* x);
270 const double t0[3], const double t1[3], const double t2[3], const double* x);
273
275
280 void SetPointCoordinates(vtkIdType ptId, const double* x);
281
290 void SetPointActiveAttributes(vtkIdType ptId, const double* x);
291
304 void SetPointAttributeArray(vtkIdType ptId[2], const double* x);
305 void GetPointAttributeArray(vtkIdType ptId, double* x);
307
313
318
319 bool MapPointData = false;
320
326
332
341
343 {
344 double* Quadric;
345 };
346
347 // One ErrorQuadric per point
349
350 // Controlling regularization behavior
352 double Regularization = 0.05;
353
354 // Controlling the boundary weighting behavior
357
358 // Contains 4 doubles per point. Length = nPoints * 4
361 double AttributeScale[6];
362
363 // Temporary variables for performance
365 double* TempX;
366 double* TempQuad;
367 double* TempB;
368 double** TempA;
369 double* TempData;
370
371private:
373 void operator=(const vtkQuadricDecimation&) = delete;
374
375 // Maximum allowed absolute error for stopping criteria.
376 double MaximumError = VTK_DOUBLE_MAX;
377};
378
379VTK_ABI_NAMESPACE_END
380#endif
RealT t2
Definition PyrC2Basis.h:22
dynamic, self-adjusting array of double
keep track of edges (edge is pair of integer id's)
list of point or cell ids
Definition vtkIdList.h:24
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
a list of ids arranged in priority order
void SetPointAttributeArray(vtkIdType ptId[2], const double *x)
Helper function to set and get the point and it's attributes as an array.
void AddBoundaryConstraints()
Free boundary edges are weighted.
vtkDoubleArray * TargetPoints
void FindAffectedEdges(vtkIdType p1Id, vtkIdType p2Id, vtkIdList *edges)
Find all edges that will have an endpoint change ids because of an edge collapse.
void ComputeNumberOfComponents()
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void ComputeQuadric(vtkIdType pointId)
Compute quadric for this vertex.
void GetAttributeComponents()
Find out how many components there are for each attribute for this poly data.
void SetPointCoordinates(vtkIdType ptId, const double *x)
Helper function to set the new point coordinates.
double ComputeCost2(vtkIdType edgeId, double *x)
Compute cost for contracting this edge and the point that gives us this cost.
static vtkQuadricDecimation * New()
void GetPointAttributeArray(vtkIdType ptId, double *x)
Helper function to set the new point coordinates.
vtkIdType GetEdgeCellId(vtkIdType p1Id, vtkIdType p2Id)
Find a cell that uses this edge.
double ComputeCost(vtkIdType edgeId, double *x)
Compute cost for contracting this edge and the point that gives us this cost.
int CollapseEdge(vtkIdType pt0Id, vtkIdType pt1Id)
Do the dirty work of eliminating the edge; return the number of triangles deleted.
vtkPriorityQueue * EdgeCosts
vtkTypeBool WeighBoundaryConstraintsByLength
~vtkQuadricDecimation() override
int TrianglePlaneCheck(const double t0[3], const double t1[3], const double t2[3], const double *x)
void SetPointActiveAttributes(vtkIdType ptId, const double *x)
Helper function to set the point coordinates and it's attributes.
void InitializeQuadrics(vtkIdType numPts)
Compute quadric for all vertices.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId)
Add the quadrics for these 2 points since the edge between them has been collapsed.
int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double *x)
void UpdateEdgeData(vtkIdType pt0Id, vtkIdType pt1Id)
int vtkTypeBool
Definition vtkABI.h:64
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
int vtkIdType
Definition vtkType.h:368
#define VTK_DOUBLE_MAX
Definition vtkType.h:207
#define VTK_MARSHALAUTO