VTK
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) VTK_OVERRIDE;
77
79
84 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
85 vtkGetMacro(TargetReduction, double);
87
89
94 vtkSetMacro(AttributeErrorMetric, int);
95 vtkGetMacro(AttributeErrorMetric, int);
96 vtkBooleanMacro(AttributeErrorMetric, int);
98
100
107 vtkSetMacro(VolumePreservation, int);
108 vtkGetMacro(VolumePreservation, int);
109 vtkBooleanMacro(VolumePreservation, int);
111
113
119 vtkSetMacro(ScalarsAttribute, int);
120 vtkGetMacro(ScalarsAttribute, int);
121 vtkBooleanMacro(ScalarsAttribute, int);
122 vtkSetMacro(VectorsAttribute, int);
123 vtkGetMacro(VectorsAttribute, int);
124 vtkBooleanMacro(VectorsAttribute, int);
125 vtkSetMacro(NormalsAttribute, int);
126 vtkGetMacro(NormalsAttribute, int);
127 vtkBooleanMacro(NormalsAttribute, int);
128 vtkSetMacro(TCoordsAttribute, int);
129 vtkGetMacro(TCoordsAttribute, int);
130 vtkBooleanMacro(TCoordsAttribute, int);
131 vtkSetMacro(TensorsAttribute, int);
132 vtkGetMacro(TensorsAttribute, int);
133 vtkBooleanMacro(TensorsAttribute, int);
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:
164 ~vtkQuadricDecimation() VTK_OVERRIDE;
165
166 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
167
172 int CollapseEdge(vtkIdType pt0Id, vtkIdType pt1Id);
173
177 void InitializeQuadrics(vtkIdType numPts);
178
182 void AddBoundaryConstraints(void);
183
187 void ComputeQuadric(vtkIdType pointId);
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
209 void FindAffectedEdges(vtkIdType p1Id, vtkIdType p2Id, vtkIdList *edges);
210
214 vtkIdType GetEdgeCellId(vtkIdType p1Id, vtkIdType p2Id);
215
216 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double *x);
217 int TrianglePlaneCheck(const double t0[3], const double t1[3],
218 const double t2[3], const double *x);
219 void ComputeNumberOfComponents(void);
220 void UpdateEdgeData(vtkIdType ptoId, vtkIdType pt1Id);
221
223
226 void SetPointAttributeArray(vtkIdType ptId, const double *x);
227 void GetPointAttributeArray(vtkIdType ptId, double *x);
229
234 void GetAttributeComponents();
235
236 double TargetReduction;
237 double ActualReduction;
238 int AttributeErrorMetric;
239 int VolumePreservation;
240
241 int ScalarsAttribute;
242 int VectorsAttribute;
243 int NormalsAttribute;
244 int TCoordsAttribute;
245 int TensorsAttribute;
246
247 double ScalarsWeight;
248 double VectorsWeight;
249 double NormalsWeight;
250 double TCoordsWeight;
251 double TensorsWeight;
252
253 int NumberOfEdgeCollapses;
255 vtkIdList *EndPoint1List;
256 vtkIdList *EndPoint2List;
258 vtkDoubleArray *TargetPoints;
259 int NumberOfComponents;
261
263 {
264 double *Quadric;
265 };
266
267
268 // One ErrorQuadric per point
270
271 // Contains 4 doubles per point. Length = nPoints * 4
273 int AttributeComponents[6];
274 double AttributeScale[6];
275
276 // Temporary variables for performance
278 double *TempX;
279 double *TempQuad;
280 double *TempB;
281 double **TempA;
282 double *TempData;
283
284private:
285 vtkQuadricDecimation(const vtkQuadricDecimation&) VTK_DELETE_FUNCTION;
286 void operator=(const vtkQuadricDecimation&) VTK_DELETE_FUNCTION;
287};
288
289#endif
dynamic, self-adjusting array of double
keep track of edges (edge is pair of integer id's)
Definition: vtkEdgeTable.h:41
list of point or cell ids
Definition: vtkIdList.h:37
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
Definition: vtkPointData.h:38
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
a list of ids arranged in priority order
reduce the number of triangles in a mesh
static vtkQuadricDecimation * New()
~vtkQuadricDecimation() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287