VTK  9.2.20230320
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 =========================================================================*/
92 #ifndef vtkBinnedDecimation_h
93 #define vtkBinnedDecimation_h
94 
95 #include "vtkFiltersCoreModule.h" // For export macro
96 #include "vtkPolyDataAlgorithm.h"
97 
98 VTK_ABI_NAMESPACE_BEGIN
99 class VTKFILTERSCORE_EXPORT vtkBinnedDecimation : public vtkPolyDataAlgorithm
100 {
101 public:
103 
108  void PrintSelf(ostream& os, vtkIndent indent) override;
110 
112 
123  void SetNumberOfXDivisions(int num);
124  void SetNumberOfYDivisions(int num);
125  void SetNumberOfZDivisions(int num);
126  vtkGetMacro(NumberOfXDivisions, int);
127  vtkGetMacro(NumberOfYDivisions, int);
128  vtkGetMacro(NumberOfZDivisions, int);
129  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
130  void SetNumberOfDivisions(int div0, int div1, int div2);
132  void GetNumberOfDivisions(int div[3]);
134 
136 
141  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
142  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
143  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
145 
147 
153  void SetDivisionOrigin(double x, double y, double z);
154  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
155  vtkGetVector3Macro(DivisionOrigin, double);
156  void SetDivisionSpacing(double x, double y, double z);
157  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
158  vtkGetVector3Macro(DivisionSpacing, double);
160 
162 
181  enum
182  {
183  INPUT_POINTS = 1,
184  BIN_POINTS = 2,
185  BIN_CENTERS = 3,
186  BIN_AVERAGES = 4
187  };
188  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
189  vtkGetMacro(PointGenerationMode, int);
190  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
191  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
192  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
193  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
195 
197 
207  vtkSetMacro(ProducePointData, bool);
208  vtkGetMacro(ProducePointData, bool);
209  vtkBooleanMacro(ProducePointData, bool);
211 
213 
217  vtkSetMacro(ProduceCellData, bool);
218  vtkGetMacro(ProduceCellData, bool);
219  vtkBooleanMacro(ProduceCellData, bool);
220 
222 
228  bool GetLargeIds() { return this->LargeIds; }
229 
230 protected:
233 
236 
240  int NumberOfDivisions[3];
241 
242  // Since there are two ways of specifying the grid, we the the flag below
243  // to indicate which the user has set. When this flag is on, the bin sizes
244  // are computed from the DivisionOrigin and DivisionSpacing.
246 
248  double DivisionOrigin[3];
249  double DivisionSpacing[3];
250  double Bounds[6];
251 
255  bool LargeIds;
256 
257  // Helper function
258  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
259 
260 private:
261  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
262  void operator=(const vtkBinnedDecimation&) = delete;
263 };
264 
265 VTK_ABI_NAMESPACE_END
266 #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:120
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:201
int vtkIdType
Definition: vtkType.h:327
#define VTK_SIZEHINT(...)