VTK
vtkQuadricClustering.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQuadricClustering.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 =========================================================================*/
87 #ifndef vtkQuadricClustering_h
88 #define vtkQuadricClustering_h
89 
90 #include "vtkFiltersCoreModule.h" // For export macro
91 #include "vtkPolyDataAlgorithm.h"
92 
93 class vtkCellArray;
94 class vtkFeatureEdges;
95 class vtkPoints;
96 class vtkQuadricClusteringCellSet;
97 
98 
100 {
101 public:
103 
105  void PrintSelf(ostream& os, vtkIndent indent);
106  static vtkQuadricClustering *New();
108 
110 
115  void SetNumberOfXDivisions(int num);
116  void SetNumberOfYDivisions(int num);
117  void SetNumberOfZDivisions(int num);
118  vtkGetMacro(NumberOfXDivisions, int);
119  vtkGetMacro(NumberOfYDivisions, int);
120  vtkGetMacro(NumberOfZDivisions, int);
121  void SetNumberOfDivisions(int div[3])
122  { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
123  void SetNumberOfDivisions(int div0, int div1, int div2);
124  int *GetNumberOfDivisions();
125  void GetNumberOfDivisions(int div[3]);
127 
129 
132  vtkSetMacro(AutoAdjustNumberOfDivisions,int);
133  vtkGetMacro(AutoAdjustNumberOfDivisions,int);
134  vtkBooleanMacro(AutoAdjustNumberOfDivisions,int);
136 
138 
142  void SetDivisionOrigin(double x, double y, double z);
143  void SetDivisionOrigin(double o[3])
144  {this->SetDivisionOrigin(o[0],o[1],o[2]);}
145  vtkGetVector3Macro(DivisionOrigin, double);
146  void SetDivisionSpacing(double x, double y, double z);
147  void SetDivisionSpacing(double s[3])
148  {this->SetDivisionSpacing(s[0],s[1],s[2]);}
149  vtkGetVector3Macro(DivisionSpacing, double);
151 
153 
159  vtkSetMacro(UseInputPoints, int);
160  vtkGetMacro(UseInputPoints, int);
161  vtkBooleanMacro(UseInputPoints, int);
163 
165 
169  vtkSetMacro(UseFeatureEdges, int);
170  vtkGetMacro(UseFeatureEdges, int);
171  vtkBooleanMacro(UseFeatureEdges, int);
172  vtkFeatureEdges *GetFeatureEdges() {return this->FeatureEdges;}
174 
176 
181  vtkSetMacro(UseFeaturePoints, int);
182  vtkGetMacro(UseFeaturePoints, int);
183  vtkBooleanMacro(UseFeaturePoints, int);
185 
187 
189  vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
190  vtkGetMacro(FeaturePointsAngle, double);
192 
194 
198  vtkSetMacro(UseInternalTriangles, int);
199  vtkGetMacro(UseInternalTriangles, int);
200  vtkBooleanMacro(UseInternalTriangles, int);
202 
204 
208  void StartAppend(double *bounds);
209  void StartAppend(double x0,double x1,double y0,double y1,double z0,double z1)
210  {double b[6]; b[0]=x0; b[1]=x1; b[2]=y0; b[3]=y1; b[4]=z0; b[5]=z1;
211  this->StartAppend(b);}
212  void Append(vtkPolyData *piece);
213  void EndAppend();
215 
217 
221  vtkSetMacro(CopyCellData, int);
222  vtkGetMacro(CopyCellData, int);
223  vtkBooleanMacro(CopyCellData, int);
225 
227 
231  vtkSetMacro(PreventDuplicateCells,int);
232  vtkGetMacro(PreventDuplicateCells,int);
233  vtkBooleanMacro(PreventDuplicateCells,int);
235 
236 protected:
239 
242 
244  vtkIdType HashPoint(double point[3]);
245 
247 
248  void ComputeRepresentativePoint(double quadric[9], vtkIdType binId,
249  double point[3]);
251 
253 
255  void AddPolygons(vtkCellArray *polys, vtkPoints *points, int geometryFlag,
256  vtkPolyData *input, vtkPolyData *output);
257  void AddStrips(vtkCellArray *strips, vtkPoints *points, int geometryFlag,
258  vtkPolyData *input, vtkPolyData *output);
259  void AddTriangle(vtkIdType *binIds, double *pt0, double *pt1, double *pt2,
260  int geometeryFlag, vtkPolyData *input, vtkPolyData *output);
262 
264 
266  void AddEdges(vtkCellArray *edges, vtkPoints *points,
267  int geometryFlag,
268  vtkPolyData *input, vtkPolyData *output);
269  void AddEdge(vtkIdType *binIds, double *pt0, double *pt1, int geometeryFlag,
270  vtkPolyData *input, vtkPolyData *output);
272 
274 
276  void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag,
277  vtkPolyData *input, vtkPolyData *output);
278  void AddVertex(vtkIdType binId, double *pt, int geometryFlag,
279  vtkPolyData *input, vtkPolyData *output);
281 
283  void InitializeQuadric(double quadric[9]);
284 
286  void AddQuadric(vtkIdType binId, double quadric[9]);
287 
292  void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, double angle);
293 
295 
297  void EndAppendUsingPoints(vtkPolyData *input, vtkPolyData *output);
300 
303  void EndAppendVertexGeometry(vtkPolyData *input, vtkPolyData *output);
304 
305  // Unfinished option to handle boundary edges differently.
306  void AppendFeatureQuadrics(vtkPolyData *pd, vtkPolyData *output);
310 
314 
315  // Set this to eliminate duplicate cells
317  vtkQuadricClusteringCellSet *CellSet; //PIMPLd stl set for tracking inserted cells
319 
320  // Used internally.
321  // can be smaller than user values when input numb er of points is small.
322  int NumberOfDivisions[3];
323 
324  // Since there are two was of specifing the grid, we have this flag
325  // to indicate which the user has set. When this flag is on,
326  // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
328 
329  double DivisionOrigin[3];
330  double DivisionSpacing[3];
332 
333  double Bounds[6];
334  double XBinSize;
335  double YBinSize;
336  double ZBinSize;
337  double XBinStep; //replace some divisions with multiplication
338  double YBinStep;
339  double ZBinStep;
340  vtkIdType SliceSize; //eliminate one multiplication
341 
342  //BTX
344  {
345  PointQuadric():VertexId(-1),Dimension(255) {}
346 
348  // Dimension is supposed to be a flag representing the dimension of the
349  // cells contributing to the quadric. Lines: 1, Triangles: 2 (and points
350  // 0 in the future?)
351  unsigned char Dimension;
352  double Quadric[9];
353  };
354  //ETX
355 
358 
359  // Have to make these instance variables if we are going to allow
360  // the algorithm to be driven by the Append methods.
363 
367 
371 
372 private:
373  vtkQuadricClustering(const vtkQuadricClustering&); // Not implemented.
374  void operator=(const vtkQuadricClustering&); // Not implemented.
375 };
376 
377 #endif
void SetDivisionOrigin(double o[3])
virtual int FillInputPortInformation(int port, vtkInformation *info)
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
vtkCellArray * OutputTriangleArray
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
void SetNumberOfDivisions(int div[3])
vtkFeatureEdges * FeatureEdges
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
vtkQuadricClusteringCellSet * CellSet
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:38
extract boundary, non-manifold, and/or sharp edges from polygonal data
void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
object to represent cell connectivity
Definition: vtkCellArray.h:49
vtkFeatureEdges * GetFeatureEdges()
Store zero or more vtkInformation instances.
void SetDivisionSpacing(double s[3])
represent and manipulate 3D points
Definition: vtkPoints.h:38
reduce the number of triangles in a mesh