VTK  9.1.0
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 =========================================================================*/
109 #ifndef vtkQuadricClustering_h
110 #define vtkQuadricClustering_h
111 
112 #include "vtkFiltersCoreModule.h" // For export macro
113 #include "vtkPolyDataAlgorithm.h"
114 
115 class vtkCellArray;
116 class vtkFeatureEdges;
117 class vtkPoints;
118 class vtkQuadricClusteringCellSet;
119 
120 class VTKFILTERSCORE_EXPORT vtkQuadricClustering : public vtkPolyDataAlgorithm
121 {
122 public:
124 
129  void PrintSelf(ostream& os, vtkIndent indent) override;
131 
133 
140  void SetNumberOfXDivisions(int num);
141  void SetNumberOfYDivisions(int num);
142  void SetNumberOfZDivisions(int num);
143  vtkGetMacro(NumberOfXDivisions, int);
144  vtkGetMacro(NumberOfYDivisions, int);
145  vtkGetMacro(NumberOfZDivisions, int);
146  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
147  void SetNumberOfDivisions(int div0, int div1, int div2);
149  void GetNumberOfDivisions(int div[3]);
151 
153 
158  vtkSetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
159  vtkGetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
160  vtkBooleanMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
162 
164 
170  void SetDivisionOrigin(double x, double y, double z);
171  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
172  vtkGetVector3Macro(DivisionOrigin, double);
173  void SetDivisionSpacing(double x, double y, double z);
174  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
175  vtkGetVector3Macro(DivisionSpacing, double);
177 
179 
187  vtkSetMacro(UseInputPoints, vtkTypeBool);
188  vtkGetMacro(UseInputPoints, vtkTypeBool);
189  vtkBooleanMacro(UseInputPoints, vtkTypeBool);
191 
193 
199  vtkSetMacro(UseFeatureEdges, vtkTypeBool);
200  vtkGetMacro(UseFeatureEdges, vtkTypeBool);
201  vtkBooleanMacro(UseFeatureEdges, vtkTypeBool);
202  vtkFeatureEdges* GetFeatureEdges() { return this->FeatureEdges; }
204 
206 
213  vtkSetMacro(UseFeaturePoints, vtkTypeBool);
214  vtkGetMacro(UseFeaturePoints, vtkTypeBool);
215  vtkBooleanMacro(UseFeaturePoints, vtkTypeBool);
217 
219 
223  vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
224  vtkGetMacro(FeaturePointsAngle, double);
226 
228 
234  vtkSetMacro(UseInternalTriangles, vtkTypeBool);
235  vtkGetMacro(UseInternalTriangles, vtkTypeBool);
236  vtkBooleanMacro(UseInternalTriangles, vtkTypeBool);
238 
240 
246  void StartAppend(double* bounds);
247  void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
248  {
249  double b[6];
250  b[0] = x0;
251  b[1] = x1;
252  b[2] = y0;
253  b[3] = y1;
254  b[4] = z0;
255  b[5] = z1;
256  this->StartAppend(b);
257  }
258  void Append(vtkPolyData* piece);
259  void EndAppend();
261 
263 
269  vtkSetMacro(CopyCellData, vtkTypeBool);
270  vtkGetMacro(CopyCellData, vtkTypeBool);
271  vtkBooleanMacro(CopyCellData, vtkTypeBool);
273 
275 
281  vtkSetMacro(PreventDuplicateCells, vtkTypeBool);
282  vtkGetMacro(PreventDuplicateCells, vtkTypeBool);
283  vtkBooleanMacro(PreventDuplicateCells, vtkTypeBool);
285 
286 protected:
289 
292 
297 
301  void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3]);
302 
304 
308  void AddPolygons(vtkCellArray* polys, vtkPoints* points, int geometryFlag, vtkPolyData* input,
309  vtkPolyData* output);
310  void AddStrips(vtkCellArray* strips, vtkPoints* points, int geometryFlag, vtkPolyData* input,
311  vtkPolyData* output);
312  void AddTriangle(vtkIdType* binIds, double* pt0, double* pt1, double* pt2, int geometeryFlag,
313  vtkPolyData* input, vtkPolyData* output);
315 
317 
321  void AddEdges(vtkCellArray* edges, vtkPoints* points, int geometryFlag, vtkPolyData* input,
322  vtkPolyData* output);
323  void AddEdge(vtkIdType* binIds, double* pt0, double* pt1, int geometeryFlag, vtkPolyData* input,
324  vtkPolyData* output);
326 
328 
332  void AddVertices(vtkCellArray* verts, vtkPoints* points, int geometryFlag, vtkPolyData* input,
333  vtkPolyData* output);
334  void AddVertex(
335  vtkIdType binId, double* pt, int geometryFlag, vtkPolyData* input, vtkPolyData* output);
337 
341  void InitializeQuadric(double quadric[9]);
342 
346  void AddQuadric(vtkIdType binId, double quadric[9]);
347 
354  void FindFeaturePoints(vtkCellArray* edges, vtkPoints* edgePts, double angle);
355 
357 
364 
370 
371  // Unfinished option to handle boundary edges differently.
376 
380 
381  // Set this to eliminate duplicate cells
383  vtkQuadricClusteringCellSet* CellSet; // PIMPLd stl set for tracking inserted cells
385 
386  // Used internally.
387  // can be smaller than user values when input numb er of points is small.
388  int NumberOfDivisions[3];
389 
390  // Since there are two was of specifying the grid, we have this flag
391  // to indicate which the user has set. When this flag is on,
392  // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
394 
395  double DivisionOrigin[3];
396  double DivisionSpacing[3];
398 
399  double Bounds[6];
400  double XBinSize;
401  double YBinSize;
402  double ZBinSize;
403  double XBinStep; // replace some divisions with multiplication
404  double YBinStep;
405  double ZBinStep;
406  vtkIdType SliceSize; // eliminate one multiplication
407 
409  {
411  : VertexId(-1)
412  , Dimension(255)
413  {
414  }
415 
417  // Dimension is supposed to be a flag representing the dimension of the
418  // cells contributing to the quadric. Lines: 1, Triangles: 2 (and points
419  // 0 in the future?)
420  unsigned char Dimension;
421  double Quadric[9];
422  };
423 
426 
427  // Have to make these instance variables if we are going to allow
428  // the algorithm to be driven by the Append methods.
431 
435 
439 
440 private:
442  void operator=(const vtkQuadricClustering&) = delete;
443 };
444 
445 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkQuadricClustering::QuadricArray
PointQuadric * QuadricArray
Definition: vtkQuadricClustering.h:424
vtkQuadricClustering::AddEdges
void AddEdges(vtkCellArray *edges, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add edges to the quadric array.
vtkQuadricClustering::SetDivisionSpacing
void SetDivisionSpacing(double x, double y, double z)
This is an alternative way to set up the bins.
vtkQuadricClustering::SetNumberOfXDivisions
void SetNumberOfXDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkQuadricClustering::NumberOfZDivisions
int NumberOfZDivisions
Definition: vtkQuadricClustering.h:379
vtkQuadricClustering::UseInternalTriangles
vtkTypeBool UseInternalTriangles
Definition: vtkQuadricClustering.h:375
vtkQuadricClustering::UseFeaturePoints
vtkTypeBool UseFeaturePoints
Definition: vtkQuadricClustering.h:374
vtkQuadricClustering::ComputeRepresentativePoint
void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3])
Determine the representative point for this bin.
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkQuadricClustering::UseInputPoints
vtkTypeBool UseInputPoints
This method will rep[lace the quadric generated points with the input points with the lowest error.
Definition: vtkQuadricClustering.h:362
vtkQuadricClustering::ZBinSize
double ZBinSize
Definition: vtkQuadricClustering.h:402
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkQuadricClustering::OutCellCount
int OutCellCount
Definition: vtkQuadricClustering.h:438
vtkQuadricClustering::NumberOfYDivisions
int NumberOfYDivisions
Definition: vtkQuadricClustering.h:378
vtkQuadricClustering::EndAppendUsingPoints
void EndAppendUsingPoints(vtkPolyData *input, vtkPolyData *output)
This method will rep[lace the quadric generated points with the input points with the lowest error.
vtkQuadricClustering::InitializeQuadric
void InitializeQuadric(double quadric[9])
Initialize the quadric matrix to 0's.
vtkQuadricClustering::AddStrips
void AddStrips(vtkCellArray *strips, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
vtkQuadricClustering::FeatureEdges
vtkFeatureEdges * FeatureEdges
Definition: vtkQuadricClustering.h:432
vtkQuadricClustering::OutputTriangleArray
vtkCellArray * OutputTriangleArray
Definition: vtkQuadricClustering.h:429
vtkQuadricClustering::~vtkQuadricClustering
~vtkQuadricClustering() override
vtkQuadricClustering::AddTriangle
void AddTriangle(vtkIdType *binIds, double *pt0, double *pt1, double *pt2, int geometeryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
vtkQuadricClustering::AddQuadric
void AddQuadric(vtkIdType binId, double quadric[9])
Add this quadric to the quadric already associated with this bin.
vtkQuadricClustering::PointQuadric::VertexId
vtkIdType VertexId
Definition: vtkQuadricClustering.h:416
vtkQuadricClustering::New
static vtkQuadricClustering * New()
Standard instantiation, type and print methods.
vtkQuadricClustering::SetNumberOfDivisions
void SetNumberOfDivisions(int div0, int div1, int div2)
Set/Get the number of divisions along each axis for the spatial bins.
vtkPolyDataAlgorithm.h
vtkQuadricClustering::PointQuadric::PointQuadric
PointQuadric()
Definition: vtkQuadricClustering.h:410
vtkQuadricClustering::AddVertices
void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add vertices to the quadric array.
vtkQuadricClustering::CopyCellData
vtkTypeBool CopyCellData
Definition: vtkQuadricClustering.h:436
vtkQuadricClustering::SetNumberOfDivisions
void SetNumberOfDivisions(int div[3])
Set/Get the number of divisions along each axis for the spatial bins.
Definition: vtkQuadricClustering.h:146
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkQuadricClustering::AutoAdjustNumberOfDivisions
vtkTypeBool AutoAdjustNumberOfDivisions
Definition: vtkQuadricClustering.h:397
vtkQuadricClustering::SetNumberOfYDivisions
void SetNumberOfYDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkQuadricClustering::EndAppendVertexGeometry
void EndAppendVertexGeometry(vtkPolyData *input, vtkPolyData *output)
This method sets the vertices of the output.
vtkQuadricClustering::PointQuadric
Definition: vtkQuadricClustering.h:409
vtkQuadricClustering::NumberOfXDivisions
int NumberOfXDivisions
Definition: vtkQuadricClustering.h:377
vtkQuadricClustering::SetDivisionSpacing
void SetDivisionSpacing(double s[3])
This is an alternative way to set up the bins.
Definition: vtkQuadricClustering.h:174
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkQuadricClustering::SliceSize
vtkIdType SliceSize
Definition: vtkQuadricClustering.h:406
vtkQuadricClustering::YBinStep
double YBinStep
Definition: vtkQuadricClustering.h:404
vtkQuadricClustering::GetFeatureEdges
vtkFeatureEdges * GetFeatureEdges()
By default, this flag is off.
Definition: vtkQuadricClustering.h:202
vtkQuadricClustering::AddVertex
void AddVertex(vtkIdType binId, double *pt, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add vertices to the quadric array.
vtkQuadricClustering
reduce the number of triangles in a mesh
Definition: vtkQuadricClustering.h:121
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkQuadricClustering::HashPoint
vtkIdType HashPoint(double point[3])
Given a point, determine what bin it falls into.
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkFeatureEdges
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
Definition: vtkFeatureEdges.h:137
vtkQuadricClustering::NumberOfBinsUsed
vtkIdType NumberOfBinsUsed
Definition: vtkQuadricClustering.h:425
vtkQuadricClustering::vtkQuadricClustering
vtkQuadricClustering()
vtkQuadricClustering::FeaturePointsAngle
double FeaturePointsAngle
Definition: vtkQuadricClustering.h:434
vtkQuadricClustering::AddEdge
void AddEdge(vtkIdType *binIds, double *pt0, double *pt1, int geometeryFlag, vtkPolyData *input, vtkPolyData *output)
Add edges to the quadric array.
vtkQuadricClustering::StartAppend
void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
These methods provide an alternative way of executing the filter.
Definition: vtkQuadricClustering.h:247
vtkQuadricClustering::CellSet
vtkQuadricClusteringCellSet * CellSet
Definition: vtkQuadricClustering.h:383
vtkQuadricClustering::AppendFeatureQuadrics
void AppendFeatureQuadrics(vtkPolyData *pd, vtkPolyData *output)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkQuadricClustering::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkQuadricClustering::FillInputPortInformation
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkQuadricClustering::SetNumberOfZDivisions
void SetNumberOfZDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkQuadricClustering::SetDivisionOrigin
void SetDivisionOrigin(double o[3])
This is an alternative way to set up the bins.
Definition: vtkQuadricClustering.h:171
vtkQuadricClustering::YBinSize
double YBinSize
Definition: vtkQuadricClustering.h:401
vtkQuadricClustering::UseFeatureEdges
vtkTypeBool UseFeatureEdges
Definition: vtkQuadricClustering.h:373
vtkQuadricClustering::XBinSize
double XBinSize
Definition: vtkQuadricClustering.h:400
vtkQuadricClustering::OutputLines
vtkCellArray * OutputLines
Definition: vtkQuadricClustering.h:430
vtkQuadricClustering::NumberOfBins
vtkIdType NumberOfBins
Definition: vtkQuadricClustering.h:384
vtkQuadricClustering::AddPolygons
void AddPolygons(vtkCellArray *polys, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
vtkQuadricClustering::PreventDuplicateCells
vtkTypeBool PreventDuplicateCells
Definition: vtkQuadricClustering.h:382
vtkQuadricClustering::InCellCount
int InCellCount
Definition: vtkQuadricClustering.h:437
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkQuadricClustering::StartAppend
void StartAppend(double *bounds)
These methods provide an alternative way of executing the filter.
edges
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
Definition: vtkBoostGraphAdapter.h:1027
vtkQuadricClustering::GetNumberOfDivisions
int * GetNumberOfDivisions()
Set/Get the number of divisions along each axis for the spatial bins.
vtkQuadricClustering::Append
void Append(vtkPolyData *piece)
These methods provide an alternative way of executing the filter.
vtkQuadricClustering::EndAppend
void EndAppend()
These methods provide an alternative way of executing the filter.
vtkQuadricClustering::ComputeNumberOfDivisions
int ComputeNumberOfDivisions
Definition: vtkQuadricClustering.h:393
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkQuadricClustering::XBinStep
double XBinStep
Definition: vtkQuadricClustering.h:403
vtkQuadricClustering::FindFeaturePoints
void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, double angle)
Find the feature points of a given set of edges.
vtkQuadricClustering::PointQuadric::Dimension
unsigned char Dimension
Definition: vtkQuadricClustering.h:420
vtkQuadricClustering::ZBinStep
double ZBinStep
Definition: vtkQuadricClustering.h:405
vtkQuadricClustering::FeaturePoints
vtkPoints * FeaturePoints
Definition: vtkQuadricClustering.h:433
vtkQuadricClustering::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard instantiation, type and print methods.
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:151