VTK  9.4.20251007
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
46
47#ifndef vtkQuadricDecimation_h
48#define vtkQuadricDecimation_h
49
50#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
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
74 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
75 vtkGetMacro(TargetReduction, double);
77
79
88
90
101
103
118 vtkSetMacro(Regularize, vtkTypeBool);
119 vtkGetMacro(Regularize, vtkTypeBool);
120 vtkBooleanMacro(Regularize, vtkTypeBool);
121 vtkSetMacro(Regularization, double);
122 vtkGetMacro(Regularization, double);
124
126
137 vtkSetMacro(BoundaryWeightFactor, double);
138 vtkGetMacro(BoundaryWeightFactor, double);
140
142
145 vtkGetMacro(MapPointData, bool);
146 vtkSetMacro(MapPointData, bool);
147 vtkBooleanMacro(MapPointData, bool);
149
151
159 vtkBooleanMacro(ScalarsAttribute, vtkTypeBool);
162 vtkBooleanMacro(VectorsAttribute, vtkTypeBool);
165 vtkBooleanMacro(NormalsAttribute, vtkTypeBool);
168 vtkBooleanMacro(TCoordsAttribute, vtkTypeBool);
171 vtkBooleanMacro(TensorsAttribute, vtkTypeBool);
173
175
180 vtkSetMacro(ScalarsWeight, double);
181 vtkSetMacro(VectorsWeight, double);
182 vtkSetMacro(NormalsWeight, double);
183 vtkSetMacro(TCoordsWeight, double);
184 vtkSetMacro(TensorsWeight, double);
185 vtkGetMacro(ScalarsWeight, double);
186 vtkGetMacro(VectorsWeight, double);
187 vtkGetMacro(NormalsWeight, double);
188 vtkGetMacro(TCoordsWeight, double);
189 vtkGetMacro(TensorsWeight, double);
191
193
197 vtkGetMacro(ActualReduction, double);
199
200protected:
203
205
211
216
221
226
231 void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
232
234
238 double ComputeCost(vtkIdType edgeId, double* x);
239 double ComputeCost2(vtkIdType edgeId, double* x);
241
248
253
254 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double* x);
256 const double t0[3], const double t1[3], const double t2[3], const double* x);
259
261
266 VTK_DEPRECATED_IN_9_3_0("Deprecated in favor of the method taking the indexes of both points on "
267 "the edge to interpolate point data")
268 void SetPointAttributeArray(vtkIdType ptId, const double* x);
269 void SetPointAttributeArray(vtkIdType ptId[2], const double* x);
270 void GetPointAttributeArray(vtkIdType ptId, double* x);
272
278
283
284 bool MapPointData = false;
285
291
297
306
308 {
309 double* Quadric;
310 };
311
312 // One ErrorQuadric per point
314
315 // Controlling regularization behavior
317 double Regularization = 0.05;
318
319 // Controlling the boundary weighting behavior
322
323 // Contains 4 doubles per point. Length = nPoints * 4
326 double AttributeScale[6];
327
328 // Temporary variables for performance
330 double* TempX;
331 double* TempQuad;
332 double* TempB;
333 double** TempA;
334 double* TempData;
335
336private:
338 void operator=(const vtkQuadricDecimation&) = delete;
339};
340
341VTK_ABI_NAMESPACE_END
342#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 AddBoundaryConstraints()
Free boundary edges are weighted.
void SetPointAttributeArray(vtkIdType ptId, const double *x)
Helper function to set and get the point and it's attributes as an array.
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)
#define VTK_DEPRECATED_IN_9_3_0(reason)
int vtkIdType
Definition vtkType.h:315