VTK  9.5.2
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
54VTK_ABI_NAMESPACE_BEGIN
55class vtkEdgeTable;
56class vtkIdList;
57class vtkPointData;
59class vtkDoubleArray;
60
61class VTKFILTERSCORE_EXPORT vtkQuadricDecimation : public vtkPolyDataAlgorithm
62{
63public:
65 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
75 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
76 vtkGetMacro(TargetReduction, double);
78
80
89
91
102
104
109 vtkSetMacro(MaximumError, double);
110 vtkGetMacro(MaximumError, double);
112
114
129 vtkSetMacro(Regularize, vtkTypeBool);
130 vtkGetMacro(Regularize, vtkTypeBool);
131 vtkBooleanMacro(Regularize, vtkTypeBool);
132 vtkSetMacro(Regularization, double);
133 vtkGetMacro(Regularization, double);
135
137
148 vtkSetMacro(BoundaryWeightFactor, double);
149 vtkGetMacro(BoundaryWeightFactor, double);
151
153
158 vtkGetMacro(MapPointData, bool);
159 vtkSetMacro(MapPointData, bool);
160 vtkBooleanMacro(MapPointData, bool);
162
164
172 vtkBooleanMacro(ScalarsAttribute, vtkTypeBool);
175 vtkBooleanMacro(VectorsAttribute, vtkTypeBool);
178 vtkBooleanMacro(NormalsAttribute, vtkTypeBool);
181 vtkBooleanMacro(TCoordsAttribute, vtkTypeBool);
184 vtkBooleanMacro(TensorsAttribute, vtkTypeBool);
186
188
193 vtkSetMacro(ScalarsWeight, double);
194 vtkSetMacro(VectorsWeight, double);
195 vtkSetMacro(NormalsWeight, double);
196 vtkSetMacro(TCoordsWeight, double);
197 vtkSetMacro(TensorsWeight, double);
198 vtkGetMacro(ScalarsWeight, double);
199 vtkGetMacro(VectorsWeight, double);
200 vtkGetMacro(NormalsWeight, double);
201 vtkGetMacro(TCoordsWeight, double);
202 vtkGetMacro(TensorsWeight, double);
204
206
210 vtkGetMacro(ActualReduction, double);
212
213protected:
216
218
224
229
234
239
244 void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
245
247
251 double ComputeCost(vtkIdType edgeId, double* x);
252 double ComputeCost2(vtkIdType edgeId, double* x);
254
261
266
267 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double* x);
269 const double t0[3], const double t1[3], const double t2[3], const double* x);
272
274
279 void SetPointAttributeArray(vtkIdType ptId[2], const double* x);
280 void GetPointAttributeArray(vtkIdType ptId, double* x);
282
288
293
294 bool MapPointData = false;
295
301
307
316
318 {
319 double* Quadric;
320 };
321
322 // One ErrorQuadric per point
324
325 // Controlling regularization behavior
327 double Regularization = 0.05;
328
329 // Controlling the boundary weighting behavior
332
333 // Contains 4 doubles per point. Length = nPoints * 4
336 double AttributeScale[6];
337
338 // Temporary variables for performance
340 double* TempX;
341 double* TempQuad;
342 double* TempB;
343 double** TempA;
344 double* TempData;
345
346private:
348 void operator=(const vtkQuadricDecimation&) = delete;
349
350 // Maximum allowed absolute error for stopping criteria.
351 double MaximumError = VTK_DOUBLE_MAX;
352};
353
354VTK_ABI_NAMESPACE_END
355#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.
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 and get the point and it's attributes as an array.
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 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:332
#define VTK_DOUBLE_MAX
Definition vtkType.h:171