VTK  9.3.20240328
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 
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);
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:
221 
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
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:108
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:180
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)