VTK  9.3.0
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
81#ifndef vtkQuadricClustering_h
82#define vtkQuadricClustering_h
83
84#include "vtkFiltersCoreModule.h" // For export macro
86
87VTK_ABI_NAMESPACE_BEGIN
88class vtkCellArray;
89class vtkFeatureEdges;
90class vtkPoints;
91class vtkQuadricClusteringCellSet;
92
93class VTKFILTERSCORE_EXPORT vtkQuadricClustering : public vtkPolyDataAlgorithm
94{
95public:
97
102 void PrintSelf(ostream& os, vtkIndent indent) override;
104
106
116 vtkGetMacro(NumberOfXDivisions, int);
117 vtkGetMacro(NumberOfYDivisions, int);
118 vtkGetMacro(NumberOfZDivisions, int);
119 void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
120 void SetNumberOfDivisions(int div0, int div1, int div2);
122 void GetNumberOfDivisions(int div[3]);
124
126
131 vtkSetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
132 vtkGetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
133 vtkBooleanMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
135
137
143 void SetDivisionOrigin(double x, double y, double z);
144 void SetDivisionOrigin(double o[3]) { 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]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
148 vtkGetVector3Macro(DivisionSpacing, double);
150
152
160 vtkSetMacro(UseInputPoints, vtkTypeBool);
161 vtkGetMacro(UseInputPoints, vtkTypeBool);
162 vtkBooleanMacro(UseInputPoints, vtkTypeBool);
164
166
172 vtkSetMacro(UseFeatureEdges, vtkTypeBool);
173 vtkGetMacro(UseFeatureEdges, vtkTypeBool);
174 vtkBooleanMacro(UseFeatureEdges, vtkTypeBool);
175 vtkFeatureEdges* GetFeatureEdges() { return this->FeatureEdges; }
177
179
186 vtkSetMacro(UseFeaturePoints, vtkTypeBool);
187 vtkGetMacro(UseFeaturePoints, vtkTypeBool);
188 vtkBooleanMacro(UseFeaturePoints, vtkTypeBool);
190
192
196 vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
197 vtkGetMacro(FeaturePointsAngle, double);
199
201
207 vtkSetMacro(UseInternalTriangles, vtkTypeBool);
208 vtkGetMacro(UseInternalTriangles, vtkTypeBool);
209 vtkBooleanMacro(UseInternalTriangles, vtkTypeBool);
211
213
219 void StartAppend(double* bounds);
220 void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
221 {
222 double b[6];
223 b[0] = x0;
224 b[1] = x1;
225 b[2] = y0;
226 b[3] = y1;
227 b[4] = z0;
228 b[5] = z1;
229 this->StartAppend(b);
230 }
231 void Append(vtkPolyData* piece);
232 void EndAppend();
234
236
242 vtkSetMacro(CopyCellData, vtkTypeBool);
243 vtkGetMacro(CopyCellData, vtkTypeBool);
244 vtkBooleanMacro(CopyCellData, vtkTypeBool);
246
248
254 vtkSetMacro(PreventDuplicateCells, vtkTypeBool);
255 vtkGetMacro(PreventDuplicateCells, vtkTypeBool);
256 vtkBooleanMacro(PreventDuplicateCells, vtkTypeBool);
258
259protected:
262
265
269 vtkIdType HashPoint(double point[3]);
270
274 void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3]);
275
277
281 void AddPolygons(vtkCellArray* polys, vtkPoints* points, int geometryFlag, vtkPolyData* input,
282 vtkPolyData* output);
283 void AddStrips(vtkCellArray* strips, vtkPoints* points, int geometryFlag, vtkPolyData* input,
284 vtkPolyData* output);
285 void AddTriangle(vtkIdType* binIds, double* pt0, double* pt1, double* pt2, int geometeryFlag,
286 vtkPolyData* input, vtkPolyData* output);
288
290
294 void AddEdges(vtkCellArray* edges, vtkPoints* points, int geometryFlag, vtkPolyData* input,
295 vtkPolyData* output);
296 void AddEdge(vtkIdType* binIds, double* pt0, double* pt1, int geometeryFlag, vtkPolyData* input,
297 vtkPolyData* output);
299
301
305 void AddVertices(vtkCellArray* verts, vtkPoints* points, int geometryFlag, vtkPolyData* input,
306 vtkPolyData* output);
308 vtkIdType binId, double* pt, int geometryFlag, vtkPolyData* input, vtkPolyData* output);
310
314 void InitializeQuadric(double quadric[9]);
315
319 void AddQuadric(vtkIdType binId, double quadric[9]);
320
327 void FindFeaturePoints(vtkCellArray* edges, vtkPoints* edgePts, double angle);
328
330
337
343
344 // Unfinished option to handle boundary edges differently.
349
353
354 // Set this to eliminate duplicate cells
356 vtkQuadricClusteringCellSet* CellSet; // PIMPLd stl set for tracking inserted cells
358
359 // Used internally.
360 // can be smaller than user values when input numb er of points is small.
361 int NumberOfDivisions[3];
362
363 // Since there are two ways of specifying the grid, we have this flag
364 // to indicate which the user has set. When this flag is on,
365 // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
367
368 double DivisionOrigin[3];
369 double DivisionSpacing[3];
371
372 double Bounds[6];
373 double XBinSize;
374 double YBinSize;
375 double ZBinSize;
376 double XBinStep; // replace some divisions with multiplication
377 double YBinStep;
378 double ZBinStep;
379 vtkIdType SliceSize; // eliminate one multiplication
380
382 {
384 : VertexId(-1)
385 , Dimension(255)
386 {
387 }
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:
415 void operator=(const vtkQuadricClustering&) = delete;
416};
417
418VTK_ABI_NAMESPACE_END
419#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:29
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
reduce the number of triangles in a mesh
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
Fill the input port information objects for this algorithm.
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 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:315
#define VTK_SIZEHINT(...)