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 =========================================================================*/
58 #ifndef __vtkQuadricDecimation_h
59 #define __vtkQuadricDecimation_h
60 
61 #include "vtkPolyDataAlgorithm.h"
62 
63 class vtkEdgeTable;
64 class vtkIdList;
65 class vtkPointData;
66 class vtkPriorityQueue;
67 class vtkDoubleArray;
68 
70 {
71 public:
73  void PrintSelf(ostream& os, vtkIndent indent);
74  static vtkQuadricDecimation *New();
75 
77 
80  vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
81  vtkGetMacro(TargetReduction, double);
83 
85 
88  vtkSetMacro(AttributeErrorMetric, int);
89  vtkGetMacro(AttributeErrorMetric, int);
90  vtkBooleanMacro(AttributeErrorMetric, int);
92 
94 
98  vtkSetMacro(ScalarsAttribute, int);
99  vtkGetMacro(ScalarsAttribute, int);
100  vtkBooleanMacro(ScalarsAttribute, int);
101  vtkSetMacro(VectorsAttribute, int);
102  vtkGetMacro(VectorsAttribute, int);
103  vtkBooleanMacro(VectorsAttribute, int);
104  vtkSetMacro(NormalsAttribute, int);
105  vtkGetMacro(NormalsAttribute, int);
106  vtkBooleanMacro(NormalsAttribute, int);
107  vtkSetMacro(TCoordsAttribute, int);
108  vtkGetMacro(TCoordsAttribute, int);
109  vtkBooleanMacro(TCoordsAttribute, int);
110  vtkSetMacro(TensorsAttribute, int);
111  vtkGetMacro(TensorsAttribute, int);
112  vtkBooleanMacro(TensorsAttribute, int);
114 
116 
119  vtkSetMacro(ScalarsWeight, double);
120  vtkSetMacro(VectorsWeight, double);
121  vtkSetMacro(NormalsWeight, double);
122  vtkSetMacro(TCoordsWeight, double);
123  vtkSetMacro(TensorsWeight, double);
124  vtkGetMacro(ScalarsWeight, double);
125  vtkGetMacro(VectorsWeight, double);
126  vtkGetMacro(NormalsWeight, double);
127  vtkGetMacro(TCoordsWeight, double);
128  vtkGetMacro(TensorsWeight, double);
130 
132 
134  vtkGetMacro(ActualReduction, double);
136 
137 protected:
140 
142 
145  int CollapseEdge(vtkIdType pt0Id, vtkIdType pt1Id);
146 
148  void InitializeQuadrics(vtkIdType numPts);
149 
151  void AddBoundaryConstraints(void);
152 
154  void ComputeQuadric(vtkIdType pointId);
155 
158  void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
159 
161 
163  double ComputeCost(vtkIdType edgeId, double *x);
164  double ComputeCost2(vtkIdType edgeId, double *x);
166 
170  void FindAffectedEdges(vtkIdType p1Id, vtkIdType p2Id, vtkIdList *edges);
171 
173  vtkIdType GetEdgeCellId(vtkIdType p1Id, vtkIdType p2Id);
174 
175  int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double *x);
176  int TrianglePlaneCheck(const double t0[3], const double t1[3],
177  const double t2[3], const double *x);
178  void ComputeNumberOfComponents(void);
179  void UpdateEdgeData(vtkIdType ptoId, vtkIdType pt1Id);
180 
182 
184  void SetPointAttributeArray(vtkIdType ptId, const double *x);
185  void GetPointAttributeArray(vtkIdType ptId, double *x);
187 
190  void GetAttributeComponents();
191 
195 
201 
207 
216 
217  //BTX
219  {
220  double *Quadric;
221  };
222  //ETX
223 
225  int AttributeComponents[6];
226  double AttributeScale[6];
227 
228  // Temporary variables for performance
230  double *TempX;
231  double *TempQuad;
232  double *TempB;
233  double **TempA;
234  double *TempData;
235 
236 private:
237  vtkQuadricDecimation(const vtkQuadricDecimation&); // Not implemented.
238  void operator=(const vtkQuadricDecimation&); // Not implemented.
239 };
240 
241 #endif
#define VTK_GRAPHICS_EXPORT
represent and manipulate point attribute data
Definition: vtkPointData.h:35
Store vtkAlgorithm input/output information.
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkDoubleArray * TargetPoints
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
keep track of edges (edge is pair of integer id's)
Definition: vtkEdgeTable.h:38
dynamic, self-adjusting array of double
an list of ids arranged in priority order
static vtkPolyDataAlgorithm * New()
reduce the number of triangles in a mesh
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
Store zero or more vtkInformation instances.
vtkPriorityQueue * EdgeCosts