VTK  9.6.1
vtkQuadricClustering.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
80
81#ifndef vtkQuadricClustering_h
82#define vtkQuadricClustering_h
83
84#include "vtkFiltersCoreModule.h" // For export macro
86#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
87
88VTK_ABI_NAMESPACE_BEGIN
89class vtkCellArray;
90class vtkFeatureEdges;
91class vtkPoints;
92class vtkQuadricClusteringCellSet;
93
94class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkQuadricClustering : public vtkPolyDataAlgorithm
95{
96public:
98
103 void PrintSelf(ostream& os, vtkIndent indent) override;
105
107
117 vtkGetMacro(NumberOfXDivisions, int);
118 vtkGetMacro(NumberOfYDivisions, int);
119 vtkGetMacro(NumberOfZDivisions, int);
120 void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
121 void SetNumberOfDivisions(int div0, int div1, int div2);
123 void GetNumberOfDivisions(int div[3]);
125
127
136
138
144 void SetDivisionOrigin(double x, double y, double z);
145 void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
146 vtkGetVector3Macro(DivisionOrigin, double);
147 void SetDivisionSpacing(double x, double y, double z);
148 void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
149 vtkGetVector3Macro(DivisionSpacing, double);
151
153
163 vtkBooleanMacro(UseInputPoints, vtkTypeBool);
165
167
175 vtkBooleanMacro(UseFeatureEdges, vtkTypeBool);
178
180
189 vtkBooleanMacro(UseFeaturePoints, vtkTypeBool);
191
193
197 vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
198 vtkGetMacro(FeaturePointsAngle, double);
200
202
212
214
220 void StartAppend(double* bounds);
221 void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
222 {
223 double b[6];
224 b[0] = x0;
225 b[1] = x1;
226 b[2] = y0;
227 b[3] = y1;
228 b[4] = z0;
229 b[5] = z1;
230 this->StartAppend(b);
231 }
232 void Append(vtkPolyData* piece);
233 void EndAppend();
235
237
245 vtkBooleanMacro(CopyCellData, vtkTypeBool);
247
249
259
260protected:
263
266
270 vtkIdType HashPoint(double point[3]);
271
275 void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3]);
276
278
282 void AddPolygons(vtkCellArray* polys, vtkPoints* points, int geometryFlag, vtkPolyData* input,
283 vtkPolyData* output);
284 void AddStrips(vtkCellArray* strips, vtkPoints* points, int geometryFlag, vtkPolyData* input,
285 vtkPolyData* output);
286 void AddTriangle(vtkIdType* binIds, double* pt0, double* pt1, double* pt2, int geometeryFlag,
287 vtkPolyData* input, vtkPolyData* output);
289
291
295 void AddEdges(vtkCellArray* edges, vtkPoints* points, int geometryFlag, vtkPolyData* input,
296 vtkPolyData* output);
297 void AddEdge(vtkIdType* binIds, double* pt0, double* pt1, int geometeryFlag, vtkPolyData* input,
298 vtkPolyData* output);
300
302
306 void AddVertices(vtkCellArray* verts, vtkPoints* points, int geometryFlag, vtkPolyData* input,
307 vtkPolyData* output);
309 vtkIdType binId, double* pt, int geometryFlag, vtkPolyData* input, vtkPolyData* output);
311
315 void InitializeQuadric(double quadric[9]);
316
320 void AddQuadric(vtkIdType binId, double quadric[9]);
321
328 void FindFeaturePoints(vtkCellArray* edges, vtkPoints* edgePts, double angle);
329
331
338
344
345 // Unfinished option to handle boundary edges differently.
350
354
355 // Set this to eliminate duplicate cells
357 vtkQuadricClusteringCellSet* CellSet; // PIMPLd stl set for tracking inserted cells
359
360 // Used internally.
361 // can be smaller than user values when input numb er of points is small.
363
364 // Since there are two ways of specifying the grid, we have this flag
365 // to indicate which the user has set. When this flag is on,
366 // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
368
369 double DivisionOrigin[3];
372
373 double Bounds[6];
374 double XBinSize;
375 double YBinSize;
376 double ZBinSize;
377 double XBinStep; // replace some divisions with multiplication
378 double YBinStep;
379 double ZBinStep;
380 vtkIdType SliceSize; // eliminate one multiplication
381
383 {
385 : VertexId(-1)
386 , Dimension(255)
387 {
388 }
389
391 // Dimension is supposed to be a flag representing the dimension of the
392 // cells contributing to the quadric. Lines: 1, Triangles: 2 (and points
393 // 0 in the future?)
394 unsigned char Dimension;
395 double Quadric[9];
396 };
397
400
401 // Have to make these instance variables if we are going to allow
402 // the algorithm to be driven by the Append methods.
405
409
413
414private:
416 void operator=(const vtkQuadricClustering&) = delete;
417};
418
419VTK_ABI_NAMESPACE_END
420#endif
object to represent cell connectivity
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:30
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
void AddPolygons(vtkCellArray *polys, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
~vtkQuadricClustering() override
void SetNumberOfZDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkQuadricClusteringCellSet * CellSet
vtkCellArray * OutputTriangleArray
int FillInputPortInformation(int, vtkInformation *) override
vtkIdType HashPoint(double point[3])
Given a point, determine what bin it falls into.
vtkTypeBool UseInputPoints
This method will rep[lace the quadric generated points with the input points with the lowest error.
void AppendFeatureQuadrics(vtkPolyData *pd, vtkPolyData *output)
static vtkQuadricClustering * New()
Standard instantiation, type and print methods.
void EndAppend()
These methods provide an alternative way of executing the filter.
void SetDivisionSpacing(double s[3])
This is an alternative way to set up the bins.
void FindFeaturePoints(vtkCellArray *edges, vtkPoints *edgePts, double angle)
Find the feature points of a given set of edges.
void EndAppendVertexGeometry(vtkPolyData *input, vtkPolyData *output)
This method sets the vertices of the output.
void SetDivisionOrigin(double o[3])
This is an alternative way to set up the bins.
vtkFeatureEdges * GetFeatureEdges()
By default, this flag is off.
void SetNumberOfDivisions(int div[3])
Set/Get the number of divisions along each axis for the spatial bins.
void InitializeQuadric(double quadric[9])
Initialize the quadric matrix to 0's.
void SetDivisionSpacing(double x, double y, double z)
This is an alternative way to set up the bins.
void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3])
Determine the representative point for this bin.
vtkFeatureEdges * FeatureEdges
void AddVertices(vtkCellArray *verts, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add vertices to the quadric array.
int * GetNumberOfDivisions()
Set/Get the number of divisions along each axis for the spatial bins.
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)
These methods provide an alternative way of executing the filter.
void AddStrips(vtkCellArray *strips, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
void EndAppendUsingPoints(vtkPolyData *input, vtkPolyData *output)
This method will rep[lace the quadric generated points with the input points with the lowest error.
void StartAppend(double *bounds)
These methods provide an alternative way of executing the filter.
void AddQuadric(vtkIdType binId, double quadric[9])
Add this quadric to the quadric already associated with this bin.
void SetNumberOfYDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard instantiation, type and print methods.
void AddEdges(vtkCellArray *edges, vtkPoints *points, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add edges to the quadric array.
vtkTypeBool AutoAdjustNumberOfDivisions
void Append(vtkPolyData *piece)
These methods provide an alternative way of executing the filter.
void SetNumberOfDivisions(int div0, int div1, int div2)
Set/Get the number of divisions along each axis for the spatial bins.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void AddVertex(vtkIdType binId, double *pt, int geometryFlag, vtkPolyData *input, vtkPolyData *output)
Add vertices to the quadric array.
void AddEdge(vtkIdType *binIds, double *pt0, double *pt1, int geometeryFlag, vtkPolyData *input, vtkPolyData *output)
Add edges to the quadric array.
void AddTriangle(vtkIdType *binIds, double *pt0, double *pt1, double *pt2, int geometeryFlag, vtkPolyData *input, vtkPolyData *output)
Add triangles to the quadric array.
void SetNumberOfXDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
int vtkTypeBool
Definition vtkABI.h:64
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
int vtkIdType
Definition vtkType.h:368
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO