VTK  9.2.6
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=========================================================================*/
112#ifndef vtkQuadricClustering_h
113#define vtkQuadricClustering_h
114
115#include "vtkFiltersCoreModule.h" // For export macro
116#include "vtkPolyDataAlgorithm.h"
117
118class vtkCellArray;
119class vtkFeatureEdges;
120class vtkPoints;
121class vtkQuadricClusteringCellSet;
122
123class VTKFILTERSCORE_EXPORT vtkQuadricClustering : public vtkPolyDataAlgorithm
124{
125public:
127
132 void PrintSelf(ostream& os, vtkIndent indent) override;
134
136
146 vtkGetMacro(NumberOfXDivisions, int);
147 vtkGetMacro(NumberOfYDivisions, int);
148 vtkGetMacro(NumberOfZDivisions, int);
149 void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
150 void SetNumberOfDivisions(int div0, int div1, int div2);
152 void GetNumberOfDivisions(int div[3]);
154
156
161 vtkSetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
162 vtkGetMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
163 vtkBooleanMacro(AutoAdjustNumberOfDivisions, vtkTypeBool);
165
167
173 void SetDivisionOrigin(double x, double y, double z);
174 void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
175 vtkGetVector3Macro(DivisionOrigin, double);
176 void SetDivisionSpacing(double x, double y, double z);
177 void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
178 vtkGetVector3Macro(DivisionSpacing, double);
180
182
190 vtkSetMacro(UseInputPoints, vtkTypeBool);
191 vtkGetMacro(UseInputPoints, vtkTypeBool);
192 vtkBooleanMacro(UseInputPoints, vtkTypeBool);
194
196
202 vtkSetMacro(UseFeatureEdges, vtkTypeBool);
203 vtkGetMacro(UseFeatureEdges, vtkTypeBool);
204 vtkBooleanMacro(UseFeatureEdges, vtkTypeBool);
205 vtkFeatureEdges* GetFeatureEdges() { return this->FeatureEdges; }
207
209
216 vtkSetMacro(UseFeaturePoints, vtkTypeBool);
217 vtkGetMacro(UseFeaturePoints, vtkTypeBool);
218 vtkBooleanMacro(UseFeaturePoints, vtkTypeBool);
220
222
226 vtkSetClampMacro(FeaturePointsAngle, double, 0.0, 180.0);
227 vtkGetMacro(FeaturePointsAngle, double);
229
231
237 vtkSetMacro(UseInternalTriangles, vtkTypeBool);
238 vtkGetMacro(UseInternalTriangles, vtkTypeBool);
239 vtkBooleanMacro(UseInternalTriangles, vtkTypeBool);
241
243
249 void StartAppend(double* bounds);
250 void StartAppend(double x0, double x1, double y0, double y1, double z0, double z1)
251 {
252 double b[6];
253 b[0] = x0;
254 b[1] = x1;
255 b[2] = y0;
256 b[3] = y1;
257 b[4] = z0;
258 b[5] = z1;
259 this->StartAppend(b);
260 }
261 void Append(vtkPolyData* piece);
262 void EndAppend();
264
266
272 vtkSetMacro(CopyCellData, vtkTypeBool);
273 vtkGetMacro(CopyCellData, vtkTypeBool);
274 vtkBooleanMacro(CopyCellData, vtkTypeBool);
276
278
284 vtkSetMacro(PreventDuplicateCells, vtkTypeBool);
285 vtkGetMacro(PreventDuplicateCells, vtkTypeBool);
286 vtkBooleanMacro(PreventDuplicateCells, vtkTypeBool);
288
289protected:
292
295
300
304 void ComputeRepresentativePoint(double quadric[9], vtkIdType binId, double point[3]);
305
307
311 void AddPolygons(vtkCellArray* polys, vtkPoints* points, int geometryFlag, vtkPolyData* input,
312 vtkPolyData* output);
313 void AddStrips(vtkCellArray* strips, vtkPoints* points, int geometryFlag, vtkPolyData* input,
314 vtkPolyData* output);
315 void AddTriangle(vtkIdType* binIds, double* pt0, double* pt1, double* pt2, int geometeryFlag,
316 vtkPolyData* input, vtkPolyData* output);
318
320
324 void AddEdges(vtkCellArray* edges, vtkPoints* points, int geometryFlag, vtkPolyData* input,
325 vtkPolyData* output);
326 void AddEdge(vtkIdType* binIds, double* pt0, double* pt1, int geometeryFlag, vtkPolyData* input,
327 vtkPolyData* output);
329
331
335 void AddVertices(vtkCellArray* verts, vtkPoints* points, int geometryFlag, vtkPolyData* input,
336 vtkPolyData* output);
338 vtkIdType binId, double* pt, int geometryFlag, vtkPolyData* input, vtkPolyData* output);
340
344 void InitializeQuadric(double quadric[9]);
345
349 void AddQuadric(vtkIdType binId, double quadric[9]);
350
357 void FindFeaturePoints(vtkCellArray* edges, vtkPoints* edgePts, double angle);
358
360
367
373
374 // Unfinished option to handle boundary edges differently.
379
383
384 // Set this to eliminate duplicate cells
386 vtkQuadricClusteringCellSet* CellSet; // PIMPLd stl set for tracking inserted cells
388
389 // Used internally.
390 // can be smaller than user values when input numb er of points is small.
391 int NumberOfDivisions[3];
392
393 // Since there are two was of specifying the grid, we have this flag
394 // to indicate which the user has set. When this flag is on,
395 // the bin sizes are computed from the DivisionOrigin and DivisionSpacing.
397
398 double DivisionOrigin[3];
399 double DivisionSpacing[3];
401
402 double Bounds[6];
403 double XBinSize;
404 double YBinSize;
405 double ZBinSize;
406 double XBinStep; // replace some divisions with multiplication
407 double YBinStep;
408 double ZBinStep;
409 vtkIdType SliceSize; // eliminate one multiplication
410
412 {
414 : VertexId(-1)
415 , Dimension(255)
416 {
417 }
418
420 // Dimension is supposed to be a flag representing the dimension of the
421 // cells contributing to the quadric. Lines: 1, Triangles: 2 (and points
422 // 0 in the future?)
423 unsigned char Dimension;
424 double Quadric[9];
425 };
426
429
430 // Have to make these instance variables if we are going to allow
431 // the algorithm to be driven by the Append methods.
434
438
442
443private:
445 void operator=(const vtkQuadricClustering&) = delete;
446};
447
448#endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:149
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
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.
@ point
Definition: vtkX3D.h:242
@ points
Definition: vtkX3D.h:452
int vtkTypeBool
Definition: vtkABI.h:69
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)