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=========================================================================*/
68#ifndef vtkQuadricDecimation_h
69#define vtkQuadricDecimation_h
70
71#include "vtkFiltersCoreModule.h" // For export macro
73
74class vtkEdgeTable;
75class vtkIdList;
76class vtkPointData;
78class vtkDoubleArray;
79
80class VTKFILTERSCORE_EXPORT vtkQuadricDecimation : public vtkPolyDataAlgorithm
81{
82public:
84 void PrintSelf(ostream& os, vtkIndent indent) override;
86
88
93 vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
94 vtkGetMacro(TargetReduction, double);
96
98
103 vtkSetMacro(AttributeErrorMetric, vtkTypeBool);
104 vtkGetMacro(AttributeErrorMetric, vtkTypeBool);
105 vtkBooleanMacro(AttributeErrorMetric, vtkTypeBool);
107
109
116 vtkSetMacro(VolumePreservation, vtkTypeBool);
117 vtkGetMacro(VolumePreservation, vtkTypeBool);
118 vtkBooleanMacro(VolumePreservation, vtkTypeBool);
120
122
128 vtkSetMacro(ScalarsAttribute, vtkTypeBool);
129 vtkGetMacro(ScalarsAttribute, vtkTypeBool);
130 vtkBooleanMacro(ScalarsAttribute, vtkTypeBool);
131 vtkSetMacro(VectorsAttribute, vtkTypeBool);
132 vtkGetMacro(VectorsAttribute, vtkTypeBool);
133 vtkBooleanMacro(VectorsAttribute, vtkTypeBool);
134 vtkSetMacro(NormalsAttribute, vtkTypeBool);
135 vtkGetMacro(NormalsAttribute, vtkTypeBool);
136 vtkBooleanMacro(NormalsAttribute, vtkTypeBool);
137 vtkSetMacro(TCoordsAttribute, vtkTypeBool);
138 vtkGetMacro(TCoordsAttribute, vtkTypeBool);
139 vtkBooleanMacro(TCoordsAttribute, vtkTypeBool);
140 vtkSetMacro(TensorsAttribute, vtkTypeBool);
141 vtkGetMacro(TensorsAttribute, vtkTypeBool);
142 vtkBooleanMacro(TensorsAttribute, vtkTypeBool);
144
146
151 vtkSetMacro(ScalarsWeight, double);
152 vtkSetMacro(VectorsWeight, double);
153 vtkSetMacro(NormalsWeight, double);
154 vtkSetMacro(TCoordsWeight, double);
155 vtkSetMacro(TensorsWeight, double);
156 vtkGetMacro(ScalarsWeight, double);
157 vtkGetMacro(VectorsWeight, double);
158 vtkGetMacro(NormalsWeight, double);
159 vtkGetMacro(TCoordsWeight, double);
160 vtkGetMacro(TensorsWeight, double);
162
164
168 vtkGetMacro(ActualReduction, double);
170
171protected:
174
176
182
187
192
197
202 void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
203
205
209 double ComputeCost(vtkIdType edgeId, double* x);
210 double ComputeCost2(vtkIdType edgeId, double* x);
212
219
224
225 int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double* x);
227 const double t0[3], const double t1[3], const double t2[3], const double* x);
230
232
235 void SetPointAttributeArray(vtkIdType ptId, const double* x);
236 void GetPointAttributeArray(vtkIdType ptId, double* x);
238
244
249
255
261
270
272 {
273 double* Quadric;
274 };
275
276 // One ErrorQuadric per point
278
279 // Contains 4 doubles per point. Length = nPoints * 4
281 int AttributeComponents[6];
282 double AttributeScale[6];
283
284 // Temporary variables for performance
286 double* TempX;
287 double* TempQuad;
288 double* TempB;
289 double** TempA;
290 double* TempData;
291
292private:
294 void operator=(const vtkQuadricDecimation&) = delete;
295};
296
297#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:43
a simple class to control print indentation
Definition vtkIndent.h:49
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
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