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=========================================================================*/
88#ifndef vtkQuadricClustering_h
89#define vtkQuadricClustering_h
90
91#include "vtkFiltersCoreModule.h" // For export macro
93
94class vtkCellArray;
95class vtkFeatureEdges;
96class vtkPoints;
97class vtkQuadricClusteringCellSet;
98
99
100class VTKFILTERSCORE_EXPORT vtkQuadricClustering : public vtkPolyDataAlgorithm
101{
102public:
104
108 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
111
113
123 vtkGetMacro(NumberOfXDivisions, int);
124 vtkGetMacro(NumberOfYDivisions, int);
125 vtkGetMacro(NumberOfZDivisions, int);
126 void SetNumberOfDivisions(int div[3])
127 { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
128 void SetNumberOfDivisions(int div0, int div1, int div2);
130 void GetNumberOfDivisions(int div[3]);
132
134
139 vtkSetMacro(AutoAdjustNumberOfDivisions,int);
140 vtkGetMacro(AutoAdjustNumberOfDivisions,int);
141 vtkBooleanMacro(AutoAdjustNumberOfDivisions,int);
143
145
151 void SetDivisionOrigin(double x, double y, double z);
152 void SetDivisionOrigin(double o[3])
153 {this->SetDivisionOrigin(o[0],o[1],o[2]);}
154 vtkGetVector3Macro(DivisionOrigin, double);
155 void SetDivisionSpacing(double x, double y, double z);
156 void SetDivisionSpacing(double s[3])
157 {this->SetDivisionSpacing(s[0],s[1],s[2]);}
158 vtkGetVector3Macro(DivisionSpacing, double);
160
162
170 vtkSetMacro(UseInputPoints, int);
171 vtkGetMacro(UseInputPoints, int);
172 vtkBooleanMacro(UseInputPoints, int);
174
176
182 vtkSetMacro(UseFeatureEdges, int);
183 vtkGetMacro(UseFeatureEdges, int);
184 vtkBooleanMacro(UseFeatureEdges, int);
185 vtkFeatureEdges *GetFeatureEdges() {return this->FeatureEdges;}
187
189
196 vtkSetMacro(UseFeaturePoints, int);
197 vtkGetMacro(UseFeaturePoints, int);
198 vtkBooleanMacro(UseFeaturePoints, int);
200
202
206 vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
207 vtkGetMacro(FeaturePointsAngle, double);
209
211
217 vtkSetMacro(UseInternalTriangles, int);
218 vtkGetMacro(UseInternalTriangles, int);
219 vtkBooleanMacro(UseInternalTriangles, int);
221
223
229 void StartAppend(double *bounds);
230 void StartAppend(double x0,double x1,double y0,double y1,double z0,double z1)
231 {double b[6]; b[0]=x0; b[1]=x1; b[2]=y0; b[3]=y1; b[4]=z0; b[5]=z1;
232 this->StartAppend(b);}
233 void Append(vtkPolyData *piece);
234 void EndAppend();
236
238
244 vtkSetMacro(CopyCellData, int);
245 vtkGetMacro(CopyCellData, int);
246 vtkBooleanMacro(CopyCellData, int);
248
250
256 vtkSetMacro(PreventDuplicateCells,int);
257 vtkGetMacro(PreventDuplicateCells,int);
258 vtkBooleanMacro(PreventDuplicateCells,int);
260
261protected:
263 ~vtkQuadricClustering() VTK_OVERRIDE;
264
265 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
266 int FillInputPortInformation(int, vtkInformation *) VTK_OVERRIDE;
267
271 vtkIdType HashPoint(double point[3]);
272
276 void ComputeRepresentativePoint(double quadric[9], vtkIdType binId,
277 double point[3]);
278
280
284 void AddPolygons(vtkCellArray *polys, vtkPoints *points, int geometryFlag,
285 vtkPolyData *input, vtkPolyData *output);
286 void AddStrips(vtkCellArray *strips, vtkPoints *points, int geometryFlag,
287 vtkPolyData *input, vtkPolyData *output);
288 void AddTriangle(vtkIdType *binIds, double *pt0, double *pt1, double *pt2,
289 int geometeryFlag, vtkPolyData *input, vtkPolyData *output);
291
293
298 int geometryFlag,
299 vtkPolyData *input, vtkPolyData *output);
300 void AddEdge(vtkIdType *binIds, double *pt0, double *pt1, int geometeryFlag,
301 vtkPolyData *input, vtkPolyData *output);
303
305
309 void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag,
310 vtkPolyData *input, vtkPolyData *output);
311 void AddVertex(vtkIdType binId, double *pt, int geometryFlag,
312 vtkPolyData *input, vtkPolyData *output);
314
318 void InitializeQuadric(double quadric[9]);
319
323 void AddQuadric(vtkIdType binId, double quadric[9]);
324
331 void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, double angle);
332
334
338 void EndAppendUsingPoints(vtkPolyData *input, vtkPolyData *output);
339 int UseInputPoints;
341
346 void EndAppendVertexGeometry(vtkPolyData *input, vtkPolyData *output);
347
348 // Unfinished option to handle boundary edges differently.
349 void AppendFeatureQuadrics(vtkPolyData *pd, vtkPolyData *output);
350 int UseFeatureEdges;
351 int UseFeaturePoints;
352 int UseInternalTriangles;
353
354 int NumberOfXDivisions;
355 int NumberOfYDivisions;
356 int NumberOfZDivisions;
357
358 // Set this to eliminate duplicate cells
359 int PreventDuplicateCells;
360 vtkQuadricClusteringCellSet *CellSet; //PIMPLd stl set for tracking inserted cells
361 vtkIdType NumberOfBins;
362
363 // Used internally.
364 // can be smaller than user values when input numb er of points is small.
365 int NumberOfDivisions[3];
366
367 // Since there are two was of specifing the grid, we have this flag
368 // to indicate which the user has set. When this flag is on,
369 // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
370 int ComputeNumberOfDivisions;
371
372 double DivisionOrigin[3];
373 double DivisionSpacing[3];
374 int AutoAdjustNumberOfDivisions;
375
376 double Bounds[6];
377 double XBinSize;
378 double YBinSize;
379 double ZBinSize;
380 double XBinStep; //replace some divisions with multiplication
381 double YBinStep;
382 double ZBinStep;
383 vtkIdType SliceSize; //eliminate one multiplication
384
386 {
387 PointQuadric():VertexId(-1),Dimension(255) {}
388
390 // Dimension is supposed to be a flag representing the dimension of the
391 // cells contributing to the quadric. Lines: 1, Triangles: 2 (and points
392 // 0 in the future?)
393 unsigned char Dimension;
394 double Quadric[9];
395 };
396
399
400 // Have to make these instance variables if we are going to allow
401 // the algorithm to be driven by the Append methods.
404
408
412
413private:
414 vtkQuadricClustering(const vtkQuadricClustering&) VTK_DELETE_FUNCTION;
415 void operator=(const vtkQuadricClustering&) VTK_DELETE_FUNCTION;
416};
417
418#endif
object to represent cell connectivity
Definition: vtkCellArray.h:51
extract boundary, non-manifold, and/or sharp edges from polygonal data
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 3D points
Definition: vtkPoints.h:40
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
reduce the number of triangles in a mesh
~vtkQuadricClustering() override
void SetNumberOfZDivisions(int num)
vtkCellArray * OutputTriangleArray
static vtkQuadricClustering * New()
void SetDivisionSpacing(double s[3])
void SetDivisionOrigin(double o[3])
vtkFeatureEdges * GetFeatureEdges()
void SetNumberOfDivisions(int div[3])
void GetNumberOfDivisions(int div[3])
void SetDivisionSpacing(double x, double y, double z)
vtkFeatureEdges * FeatureEdges
int * GetNumberOfDivisions()
void SetDivisionOrigin(double x, double y, double z)
This is an alternative way to set up the bins.
void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
void StartAppend(double *bounds)
These methods provide an alternative way of executing the filter.
void SetNumberOfYDivisions(int num)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Append(vtkPolyData *piece)
void SetNumberOfDivisions(int div0, int div1, int div2)
void SetNumberOfXDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
@ point
Definition: vtkX3D.h:236
@ points
Definition: vtkX3D.h:446
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