VTK  9.2.6
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 class VTKFILTERSCORE_EXPORT vtkBinnedDecimation : public vtkPolyDataAlgorithm
99 {
100 public:
102 
105  static vtkBinnedDecimation* New();
107  void PrintSelf(ostream& os, vtkIndent indent) override;
109 
111 
122  void SetNumberOfXDivisions(int num);
123  void SetNumberOfYDivisions(int num);
124  void SetNumberOfZDivisions(int num);
125  vtkGetMacro(NumberOfXDivisions, int);
126  vtkGetMacro(NumberOfYDivisions, int);
127  vtkGetMacro(NumberOfZDivisions, int);
128  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
129  void SetNumberOfDivisions(int div0, int div1, int div2);
130  int* GetNumberOfDivisions() VTK_SIZEHINT(3);
131  void GetNumberOfDivisions(int div[3]);
133 
135 
140  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
141  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
142  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
144 
146 
152  void SetDivisionOrigin(double x, double y, double z);
153  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
154  vtkGetVector3Macro(DivisionOrigin, double);
155  void SetDivisionSpacing(double x, double y, double z);
156  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
157  vtkGetVector3Macro(DivisionSpacing, double);
159 
161 
180  enum
181  {
182  INPUT_POINTS = 1,
183  BIN_POINTS = 2,
184  BIN_CENTERS = 3,
185  BIN_AVERAGES = 4
186  };
187  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
188  vtkGetMacro(PointGenerationMode, int);
189  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
190  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
191  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
192  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
194 
196 
206  vtkSetMacro(ProducePointData, bool);
207  vtkGetMacro(ProducePointData, bool);
208  vtkBooleanMacro(ProducePointData, bool);
210 
212 
216  vtkSetMacro(ProduceCellData, bool);
217  vtkGetMacro(ProduceCellData, bool);
218  vtkBooleanMacro(ProduceCellData, bool);
219 
221 
227  bool GetLargeIds() { return this->LargeIds; }
228 
229 protected:
231  ~vtkBinnedDecimation() override;
232 
234  int FillInputPortInformation(int, vtkInformation*) override;
235 
239  int NumberOfDivisions[3];
240 
241  // Since there are two ways of specifying the grid, we the the flag below
242  // to indicate which the user has set. When this flag is on, the bin sizes
243  // are computed from the DivisionOrigin and DivisionSpacing.
245 
247  double DivisionOrigin[3];
248  double DivisionSpacing[3];
249  double Bounds[6];
250 
254  bool LargeIds;
255 
256  // Helper function
257  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
258 
259 private:
260  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
261  void operator=(const vtkBinnedDecimation&) = delete;
262 };
263 
264 #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:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:39
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.