VTK  9.3.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 
86 VTK_ABI_NAMESPACE_BEGIN
87 class VTKFILTERSCORE_EXPORT vtkBinnedDecimation : public vtkPolyDataAlgorithm
88 {
89 public:
91 
94  static vtkBinnedDecimation* New();
96  void PrintSelf(ostream& os, vtkIndent indent) override;
98 
100 
111  void SetNumberOfXDivisions(int num);
112  void SetNumberOfYDivisions(int num);
113  void SetNumberOfZDivisions(int num);
114  vtkGetMacro(NumberOfXDivisions, int);
115  vtkGetMacro(NumberOfYDivisions, int);
116  vtkGetMacro(NumberOfZDivisions, int);
117  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
118  void SetNumberOfDivisions(int div0, int div1, int div2);
119  int* GetNumberOfDivisions() VTK_SIZEHINT(3);
120  void GetNumberOfDivisions(int div[3]);
122 
124 
129  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
130  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
131  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
133 
135 
141  void SetDivisionOrigin(double x, double y, double z);
142  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
143  vtkGetVector3Macro(DivisionOrigin, double);
144  void SetDivisionSpacing(double x, double y, double z);
145  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
146  vtkGetVector3Macro(DivisionSpacing, double);
148 
150 
169  enum
170  {
171  INPUT_POINTS = 1,
172  BIN_POINTS = 2,
173  BIN_CENTERS = 3,
174  BIN_AVERAGES = 4
175  };
176  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
177  vtkGetMacro(PointGenerationMode, int);
178  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
179  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
180  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
181  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
183 
185 
195  vtkSetMacro(ProducePointData, bool);
196  vtkGetMacro(ProducePointData, bool);
197  vtkBooleanMacro(ProducePointData, bool);
199 
201 
205  vtkSetMacro(ProduceCellData, bool);
206  vtkGetMacro(ProduceCellData, bool);
207  vtkBooleanMacro(ProduceCellData, bool);
208 
210 
216  bool GetLargeIds() { return this->LargeIds; }
217 
218 protected:
220  ~vtkBinnedDecimation() override;
221 
223  int FillInputPortInformation(int, vtkInformation*) override;
224 
228  int NumberOfDivisions[3];
229 
230  // Since there are two ways of specifying the grid, we the the flag below
231  // to indicate which the user has set. When this flag is on, the bin sizes
232  // are computed from the DivisionOrigin and DivisionSpacing.
234 
236  double DivisionOrigin[3];
237  double DivisionSpacing[3];
238  double Bounds[6];
239 
243  bool LargeIds;
244 
245  // Helper function
246  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
247 
248 private:
249  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
250  void operator=(const vtkBinnedDecimation&) = delete;
251 };
252 
253 VTK_ABI_NAMESPACE_END
254 #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:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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.
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.