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 "vtkFiltersCoreModule.h" // For export macro
62 #include "vtkPolyDataAlgorithm.h"
63 
64 class vtkEdgeTable;
65 class vtkIdList;
66 class vtkPointData;
67 class vtkPriorityQueue;
68 class vtkDoubleArray;
69 
71 {
72 public:
74  void PrintSelf(ostream& os, vtkIndent indent);
75  static vtkQuadricDecimation *New();
76 
78 
81  vtkSetClampMacro(TargetReduction, double, 0.0, 1.0);
82  vtkGetMacro(TargetReduction, double);
84 
86 
89  vtkSetMacro(AttributeErrorMetric, int);
90  vtkGetMacro(AttributeErrorMetric, int);
91  vtkBooleanMacro(AttributeErrorMetric, int);
93 
95 
99  vtkSetMacro(ScalarsAttribute, int);
100  vtkGetMacro(ScalarsAttribute, int);
101  vtkBooleanMacro(ScalarsAttribute, int);
102  vtkSetMacro(VectorsAttribute, int);
103  vtkGetMacro(VectorsAttribute, int);
104  vtkBooleanMacro(VectorsAttribute, int);
105  vtkSetMacro(NormalsAttribute, int);
106  vtkGetMacro(NormalsAttribute, int);
107  vtkBooleanMacro(NormalsAttribute, int);
108  vtkSetMacro(TCoordsAttribute, int);
109  vtkGetMacro(TCoordsAttribute, int);
110  vtkBooleanMacro(TCoordsAttribute, int);
111  vtkSetMacro(TensorsAttribute, int);
112  vtkGetMacro(TensorsAttribute, int);
113  vtkBooleanMacro(TensorsAttribute, int);
115 
117 
120  vtkSetMacro(ScalarsWeight, double);
121  vtkSetMacro(VectorsWeight, double);
122  vtkSetMacro(NormalsWeight, double);
123  vtkSetMacro(TCoordsWeight, double);
124  vtkSetMacro(TensorsWeight, double);
125  vtkGetMacro(ScalarsWeight, double);
126  vtkGetMacro(VectorsWeight, double);
127  vtkGetMacro(NormalsWeight, double);
128  vtkGetMacro(TCoordsWeight, double);
129  vtkGetMacro(TensorsWeight, double);
131 
133 
135  vtkGetMacro(ActualReduction, double);
137 
138 protected:
141 
143 
146  int CollapseEdge(vtkIdType pt0Id, vtkIdType pt1Id);
147 
149  void InitializeQuadrics(vtkIdType numPts);
150 
152  void AddBoundaryConstraints(void);
153 
155  void ComputeQuadric(vtkIdType pointId);
156 
159  void AddQuadric(vtkIdType oldPtId, vtkIdType newPtId);
160 
162 
164  double ComputeCost(vtkIdType edgeId, double *x);
165  double ComputeCost2(vtkIdType edgeId, double *x);
167 
171  void FindAffectedEdges(vtkIdType p1Id, vtkIdType p2Id, vtkIdList *edges);
172 
174  vtkIdType GetEdgeCellId(vtkIdType p1Id, vtkIdType p2Id);
175 
176  int IsGoodPlacement(vtkIdType pt0Id, vtkIdType pt1Id, const double *x);
177  int TrianglePlaneCheck(const double t0[3], const double t1[3],
178  const double t2[3], const double *x);
179  void ComputeNumberOfComponents(void);
180  void UpdateEdgeData(vtkIdType ptoId, vtkIdType pt1Id);
181 
183 
185  void SetPointAttributeArray(vtkIdType ptId, const double *x);
186  void GetPointAttributeArray(vtkIdType ptId, double *x);
188 
191  void GetAttributeComponents();
192 
196 
202 
208 
217 
218  //BTX
220  {
221  double *Quadric;
222  };
223  //ETX
224 
226  int AttributeComponents[6];
227  double AttributeScale[6];
228 
229  // Temporary variables for performance
231  double *TempX;
232  double *TempQuad;
233  double *TempB;
234  double **TempA;
235  double *TempData;
236 
237 private:
238  vtkQuadricDecimation(const vtkQuadricDecimation&); // Not implemented.
239  void operator=(const vtkQuadricDecimation&); // Not implemented.
240 };
241 
242 #endif
represent and manipulate point attribute data
Definition: vtkPointData.h:36
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)
#define VTKFILTERSCORE_EXPORT
vtkDoubleArray * TargetPoints
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
keep track of edges (edge is pair of integer id's)
Definition: vtkEdgeTable.h:39
dynamic, self-adjusting array of double
a 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:38
list of point or cell ids
Definition: vtkIdList.h:35
Store zero or more vtkInformation instances.
vtkPriorityQueue * EdgeCosts