VTK  9.1.0
vtkBinnedDecimation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBinnedDecimation.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 =========================================================================*/
89 #ifndef vtkBinnedDecimation_h
90 #define vtkBinnedDecimation_h
91 
92 #include "vtkFiltersCoreModule.h" // For export macro
93 #include "vtkPolyDataAlgorithm.h"
94 
95 class VTKFILTERSCORE_EXPORT vtkBinnedDecimation : public vtkPolyDataAlgorithm
96 {
97 public:
99 
104  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
108 
119  void SetNumberOfXDivisions(int num);
120  void SetNumberOfYDivisions(int num);
121  void SetNumberOfZDivisions(int num);
122  vtkGetMacro(NumberOfXDivisions, int);
123  vtkGetMacro(NumberOfYDivisions, int);
124  vtkGetMacro(NumberOfZDivisions, int);
125  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
126  void SetNumberOfDivisions(int div0, int div1, int div2);
128  void GetNumberOfDivisions(int div[3]);
130 
132 
137  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
138  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
139  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
141 
143 
149  void SetDivisionOrigin(double x, double y, double z);
150  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
151  vtkGetVector3Macro(DivisionOrigin, double);
152  void SetDivisionSpacing(double x, double y, double z);
153  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
154  vtkGetVector3Macro(DivisionSpacing, double);
156 
158 
177  enum
178  {
179  INPUT_POINTS = 1,
180  BIN_POINTS = 2,
181  BIN_CENTERS = 3,
182  BIN_AVERAGES = 4
183  };
184  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
185  vtkGetMacro(PointGenerationMode, int);
186  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
187  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
188  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
189  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
191 
193 
203  vtkSetMacro(ProducePointData, bool);
204  vtkGetMacro(ProducePointData, bool);
205  vtkBooleanMacro(ProducePointData, bool);
207 
209 
213  vtkSetMacro(ProduceCellData, bool);
214  vtkGetMacro(ProduceCellData, bool);
215  vtkBooleanMacro(ProduceCellData, bool);
216 
218 
224  bool GetLargeIds() { return this->LargeIds; }
225 
226 protected:
229 
232 
236  int NumberOfDivisions[3];
237 
238  // Since there are two ways of specifying the grid, we the the flag below
239  // to indicate which the user has set. When this flag is on, the bin sizes
240  // are computed from the DivisionOrigin and DivisionSpacing.
242 
244  double DivisionOrigin[3];
245  double DivisionSpacing[3];
246  double Bounds[6];
247 
251  bool LargeIds;
252 
253  // Helper function
254  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
255 
256 private:
257  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
258  void operator=(const vtkBinnedDecimation&) = delete;
259 };
260 
261 #endif
reduce the number of triangles in a vtkPolyData mesh
void SetDivisionSpacing(double x, double y, double z)
This is an alternative way to set up the bins.
void SetPointGenerationModeToBinCenters()
Four options exist for generating output points.
void ConfigureBinning(vtkPolyData *input, vtkIdType numPts)
void SetNumberOfYDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard instantiation, type and print methods.
~vtkBinnedDecimation() override
void SetNumberOfZDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
void SetDivisionOrigin(double o[3])
This is an alternative way to set up the bins.
bool GetLargeIds()
Return a flag indicating whether large ids were used during execution.
void SetPointGenerationModeToBinAverages()
Four options exist for generating output points.
void SetNumberOfXDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
int * GetNumberOfDivisions()
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.
static vtkBinnedDecimation * New()
Standard instantiation, type and print methods.
void SetNumberOfDivisions(int div[3])
Set/Get the number of divisions along each axis for the spatial bins.
void SetPointGenerationModeToBinPoints()
Four options exist for generating output points.
void SetPointGenerationModeToUseInputPoints()
Four options exist for generating output points.
void SetDivisionSpacing(double s[3])
This is an alternative way to set up the bins.
void SetNumberOfDivisions(int div0, int div1, int div2)
Set/Get the number of divisions along each axis for the spatial bins.
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)