VTK  9.7.1
vtkBinnedDecimation.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 #ifndef vtkBinnedDecimation_h
81 #define vtkBinnedDecimation_h
82 
83 #include "vtkFiltersCoreModule.h" // For export macro
84 #include "vtkPolyDataAlgorithm.h"
85 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
86 
87 VTK_ABI_NAMESPACE_BEGIN
88 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkBinnedDecimation : public vtkPolyDataAlgorithm
89 {
90 public:
92 
95  static vtkBinnedDecimation* New();
97  void PrintSelf(ostream& os, vtkIndent indent) override;
99 
101 
112  void SetNumberOfXDivisions(int num);
113  void SetNumberOfYDivisions(int num);
114  void SetNumberOfZDivisions(int num);
115  vtkGetMacro(NumberOfXDivisions, int);
116  vtkGetMacro(NumberOfYDivisions, int);
117  vtkGetMacro(NumberOfZDivisions, int);
118  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
119  void SetNumberOfDivisions(int div0, int div1, int div2);
120  int* GetNumberOfDivisions() VTK_SIZEHINT(3);
121  void GetNumberOfDivisions(int div[3]);
123 
125 
130  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
131  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
132  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
134 
136 
142  void SetDivisionOrigin(double x, double y, double z);
143  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
144  vtkGetVector3Macro(DivisionOrigin, double);
145  void SetDivisionSpacing(double x, double y, double z);
146  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
147  vtkGetVector3Macro(DivisionSpacing, double);
149 
151 
170  enum
171  {
172  INPUT_POINTS = 1,
173  BIN_POINTS = 2,
174  BIN_CENTERS = 3,
175  BIN_AVERAGES = 4
176  };
177  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
178  vtkGetMacro(PointGenerationMode, int);
179  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
180  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
181  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
182  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
184 
186 
196  vtkSetMacro(ProducePointData, bool);
197  vtkGetMacro(ProducePointData, bool);
198  vtkBooleanMacro(ProducePointData, bool);
200 
202 
206  vtkSetMacro(ProduceCellData, bool);
207  vtkGetMacro(ProduceCellData, bool);
208  vtkBooleanMacro(ProduceCellData, bool);
209 
211 
217  bool GetLargeIds() { return this->LargeIds; }
218 
219 protected:
221  ~vtkBinnedDecimation() override;
222 
224  int FillInputPortInformation(int, vtkInformation*) override;
225 
229  int NumberOfDivisions[3];
230 
231  // Since there are two ways of specifying the grid, we the the flag below
232  // to indicate which the user has set. When this flag is on, the bin sizes
233  // are computed from the DivisionOrigin and DivisionSpacing.
235 
237  double DivisionOrigin[3];
238  double DivisionSpacing[3];
239  double Bounds[6];
240 
244  bool LargeIds;
245 
246  // Helper function
247  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
248 
249 private:
250  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
251  void operator=(const vtkBinnedDecimation&) = delete;
252 };
253 
254 VTK_ABI_NAMESPACE_END
255 #endif
Store vtkAlgorithm input/output information.
void SetPointGenerationModeToBinAverages()
Four options exist for generating output points.
void SetNumberOfDivisions(int div[3])
Set/Get the number of divisions along each axis for the spatial bins.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void SetPointGenerationModeToUseInputPoints()
Four options exist for generating output points.
bool GetLargeIds()
Return a flag indicating whether large ids were used during execution.
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
void SetPointGenerationModeToBinPoints()
Four options exist for generating output points.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetDivisionSpacing(double s[3])
This is an alternative way to set up the bins.
#define VTK_SIZEHINT(...)
void SetPointGenerationModeToBinCenters()
Four options exist for generating output points.
reduce the number of triangles in a vtkPolyData mesh
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
void SetDivisionOrigin(double o[3])
This is an alternative way to set up the bins.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.