VTK  9.2.6
vtkQuadricDecimation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkQuadricDecimation.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
59#ifndef vtkQuadricDecimation_h
60#define vtkQuadricDecimation_h
61
62#include "vtkFiltersCoreModule.h" // For export macro
64
65class vtkEdgeTable;
66class vtkIdList;
67class vtkPointData;
69class vtkDoubleArray;
70
71class VTKFILTERSCORE_EXPORT vtkQuadricDecimation : public vtkPolyDataAlgorithm
72{
73public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
77
79
84 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
85 vtkGetMacro(TargetReduction, double);
87
89
94 vtkSetMacro(AttributeErrorMetric, vtkTypeBool);
95 vtkGetMacro(AttributeErrorMetric, vtkTypeBool);
96 vtkBooleanMacro(AttributeErrorMetric, vtkTypeBool);
98
100
107 vtkSetMacro(VolumePreservation, vtkTypeBool);
108 vtkGetMacro(VolumePreservation, vtkTypeBool);
109 vtkBooleanMacro(VolumePreservation, vtkTypeBool);
111
113
119 vtkSetMacro(ScalarsAttribute, vtkTypeBool);
120 vtkGetMacro(ScalarsAttribute, vtkTypeBool);
121 vtkBooleanMacro(ScalarsAttribute, vtkTypeBool);
122 vtkSetMacro(VectorsAttribute, vtkTypeBool);
123 vtkGetMacro(VectorsAttribute, vtkTypeBool);
124 vtkBooleanMacro(VectorsAttribute, vtkTypeBool);
125 vtkSetMacro(NormalsAttribute, vtkTypeBool);
126 vtkGetMacro(NormalsAttribute, vtkTypeBool);
127 vtkBooleanMacro(NormalsAttribute, vtkTypeBool);
128 vtkSetMacro(TCoordsAttribute, vtkTypeBool);
129 vtkGetMacro(TCoordsAttribute, vtkTypeBool);
130 vtkBooleanMacro(TCoordsAttribute, vtkTypeBool);
131 vtkSetMacro(TensorsAttribute, vtkTypeBool);
132 vtkGetMacro(TensorsAttribute, vtkTypeBool);
133 vtkBooleanMacro(TensorsAttribute, vtkTypeBool);
135
137
142 vtkSetMacro(ScalarsWeight, double);
143 vtkSetMacro(VectorsWeight, double);
144 vtkSetMacro(NormalsWeight, double);
145 vtkSetMacro(TCoordsWeight, double);
146 vtkSetMacro(TensorsWeight, double);
147 vtkGetMacro(ScalarsWeight, double);
148 vtkGetMacro(VectorsWeight, double);
149 vtkGetMacro(NormalsWeight, double);
150 vtkGetMacro(TCoordsWeight, double);
151 vtkGetMacro(TensorsWeight, double);
153
155
159 vtkGetMacro(ActualReduction, double);
161
162protected:
165
167
173
178
183
188
193 void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
194
196
200 double ComputeCost(vtkIdType edgeId, double* x);
201 double ComputeCost2(vtkIdType edgeId, double* x);
203
210
215
216 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double* x);
218 const double t0[3], const double t1[3], const double t2[3], const double* x);
221
223
226 void SetPointAttributeArray(vtkIdType ptId, const double* x);
227 void GetPointAttributeArray(vtkIdType ptId, double* x);
229
235
240
246
252
261
263 {
264 double* Quadric;
265 };
266
267 // One ErrorQuadric per point
269
270 // Contains 4 doubles per point. Length = nPoints * 4
272 int AttributeComponents[6];
273 double AttributeScale[6];
274
275 // Temporary variables for performance
277 double* TempX;
278 double* TempQuad;
279 double* TempB;
280 double** TempA;
281 double* TempData;
282
283private:
285 void operator=(const vtkQuadricDecimation&) = delete;
286};
287
288#endif
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:34
a simple class to control print indentation
Definition vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate point attribute data
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
a list of ids arranged in priority order
reduce the number of triangles in a mesh
void SetPointAttributeArray(vtkIdType ptId, const double *x)
Helper function to set and get the point and it's attributes as an array.
void AddBoundaryConstraints(void)
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.
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
~vtkQuadricDecimation() override
int TrianglePlaneCheck(const double t0[3], const double t1[3], const double t2[3], const double *x)
void ComputeNumberOfComponents(void)
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:69
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
int vtkIdType
Definition vtkType.h:332