VTK  9.1.0
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 =========================================================================*/
89 #ifndef vtkBinnedDecimation_h
90 #define vtkBinnedDecimation_h
91 
92 #include "vtkFiltersCoreModule.h" // For export macro
93 #include "vtkPolyDataAlgorithm.h"
94 
95 class VTKFILTERSCORE_EXPORT vtkBinnedDecimation : public vtkPolyDataAlgorithm
96 {
97 public:
99 
104  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
108 
119  void SetNumberOfXDivisions(int num);
120  void SetNumberOfYDivisions(int num);
121  void SetNumberOfZDivisions(int num);
122  vtkGetMacro(NumberOfXDivisions, int);
123  vtkGetMacro(NumberOfYDivisions, int);
124  vtkGetMacro(NumberOfZDivisions, int);
125  void SetNumberOfDivisions(int div[3]) { this->SetNumberOfDivisions(div[0], div[1], div[2]); }
126  void SetNumberOfDivisions(int div0, int div1, int div2);
128  void GetNumberOfDivisions(int div[3]);
130 
132 
137  vtkSetMacro(AutoAdjustNumberOfDivisions, bool);
138  vtkGetMacro(AutoAdjustNumberOfDivisions, bool);
139  vtkBooleanMacro(AutoAdjustNumberOfDivisions, bool);
141 
143 
149  void SetDivisionOrigin(double x, double y, double z);
150  void SetDivisionOrigin(double o[3]) { this->SetDivisionOrigin(o[0], o[1], o[2]); }
151  vtkGetVector3Macro(DivisionOrigin, double);
152  void SetDivisionSpacing(double x, double y, double z);
153  void SetDivisionSpacing(double s[3]) { this->SetDivisionSpacing(s[0], s[1], s[2]); }
154  vtkGetVector3Macro(DivisionSpacing, double);
156 
158 
177  enum
178  {
179  INPUT_POINTS = 1,
180  BIN_POINTS = 2,
181  BIN_CENTERS = 3,
182  BIN_AVERAGES = 4
183  };
184  vtkSetClampMacro(PointGenerationMode, int, INPUT_POINTS, BIN_AVERAGES);
185  vtkGetMacro(PointGenerationMode, int);
186  void SetPointGenerationModeToUseInputPoints() { this->SetPointGenerationMode(INPUT_POINTS); }
187  void SetPointGenerationModeToBinPoints() { this->SetPointGenerationMode(BIN_POINTS); }
188  void SetPointGenerationModeToBinCenters() { this->SetPointGenerationMode(BIN_CENTERS); }
189  void SetPointGenerationModeToBinAverages() { this->SetPointGenerationMode(BIN_AVERAGES); }
191 
193 
203  vtkSetMacro(ProducePointData, bool);
204  vtkGetMacro(ProducePointData, bool);
205  vtkBooleanMacro(ProducePointData, bool);
207 
209 
213  vtkSetMacro(ProduceCellData, bool);
214  vtkGetMacro(ProduceCellData, bool);
215  vtkBooleanMacro(ProduceCellData, bool);
216 
218 
224  bool GetLargeIds() { return this->LargeIds; }
225 
226 protected:
229 
232 
236  int NumberOfDivisions[3];
237 
238  // Since there are two ways of specifying the grid, we the the flag below
239  // to indicate which the user has set. When this flag is on, the bin sizes
240  // are computed from the DivisionOrigin and DivisionSpacing.
242 
244  double DivisionOrigin[3];
245  double DivisionSpacing[3];
246  double Bounds[6];
247 
251  bool LargeIds;
252 
253  // Helper function
254  void ConfigureBinning(vtkPolyData* input, vtkIdType numPts);
255 
256 private:
257  vtkBinnedDecimation(const vtkBinnedDecimation&) = delete;
258  void operator=(const vtkBinnedDecimation&) = delete;
259 };
260 
261 #endif
vtkBinnedDecimation::SetNumberOfYDivisions
void SetNumberOfYDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkBinnedDecimation::SetDivisionSpacing
void SetDivisionSpacing(double x, double y, double z)
This is an alternative way to set up the bins.
vtkBinnedDecimation::PointGenerationMode
int PointGenerationMode
Definition: vtkBinnedDecimation.h:248
vtkBinnedDecimation::GetLargeIds
bool GetLargeIds()
Return a flag indicating whether large ids were used during execution.
Definition: vtkBinnedDecimation.h:224
vtkBinnedDecimation
reduce the number of triangles in a vtkPolyData mesh
Definition: vtkBinnedDecimation.h:96
vtkBinnedDecimation::SetNumberOfDivisions
void SetNumberOfDivisions(int div0, int div1, int div2)
Set/Get the number of divisions along each axis for the spatial bins.
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkBinnedDecimation::SetNumberOfXDivisions
void SetNumberOfXDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkBinnedDecimation::FillInputPortInformation
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
vtkBinnedDecimation::ComputeNumberOfDivisions
int ComputeNumberOfDivisions
Definition: vtkBinnedDecimation.h:241
vtkBinnedDecimation::SetNumberOfDivisions
void SetNumberOfDivisions(int div[3])
Set/Get the number of divisions along each axis for the spatial bins.
Definition: vtkBinnedDecimation.h:125
vtkBinnedDecimation::SetPointGenerationModeToUseInputPoints
void SetPointGenerationModeToUseInputPoints()
Four options exist for generating output points.
Definition: vtkBinnedDecimation.h:186
vtkBinnedDecimation::New
static vtkBinnedDecimation * New()
Standard instantiation, type and print methods.
vtkBinnedDecimation::~vtkBinnedDecimation
~vtkBinnedDecimation() override
vtkBinnedDecimation::SetDivisionSpacing
void SetDivisionSpacing(double s[3])
This is an alternative way to set up the bins.
Definition: vtkBinnedDecimation.h:153
vtkBinnedDecimation::ConfigureBinning
void ConfigureBinning(vtkPolyData *input, vtkIdType numPts)
vtkPolyDataAlgorithm.h
vtkBinnedDecimation::SetDivisionOrigin
void SetDivisionOrigin(double o[3])
This is an alternative way to set up the bins.
Definition: vtkBinnedDecimation.h:150
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkBinnedDecimation::SetPointGenerationModeToBinCenters
void SetPointGenerationModeToBinCenters()
Four options exist for generating output points.
Definition: vtkBinnedDecimation.h:188
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkBinnedDecimation::vtkBinnedDecimation
vtkBinnedDecimation()
vtkBinnedDecimation::SetPointGenerationModeToBinPoints
void SetPointGenerationModeToBinPoints()
Four options exist for generating output points.
Definition: vtkBinnedDecimation.h:187
vtkBinnedDecimation::GetNumberOfDivisions
int * GetNumberOfDivisions()
Set/Get the number of divisions along each axis for the spatial bins.
vtkBinnedDecimation::SetPointGenerationModeToBinAverages
void SetPointGenerationModeToBinAverages()
Four options exist for generating output points.
Definition: vtkBinnedDecimation.h:189
vtkBinnedDecimation::NumberOfZDivisions
int NumberOfZDivisions
Definition: vtkBinnedDecimation.h:235
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkBinnedDecimation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard instantiation, type and print methods.
vtkBinnedDecimation::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkBinnedDecimation::LargeIds
bool LargeIds
Definition: vtkBinnedDecimation.h:251
vtkBinnedDecimation::ProduceCellData
bool ProduceCellData
Definition: vtkBinnedDecimation.h:250
vtkBinnedDecimation::NumberOfXDivisions
int NumberOfXDivisions
Definition: vtkBinnedDecimation.h:233
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkBinnedDecimation::ProducePointData
bool ProducePointData
Definition: vtkBinnedDecimation.h:249
vtkBinnedDecimation::SetNumberOfZDivisions
void SetNumberOfZDivisions(int num)
Set/Get the number of divisions along each axis for the spatial bins.
vtkBinnedDecimation::AutoAdjustNumberOfDivisions
bool AutoAdjustNumberOfDivisions
Definition: vtkBinnedDecimation.h:243
vtkBinnedDecimation::NumberOfYDivisions
int NumberOfYDivisions
Definition: vtkBinnedDecimation.h:234
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:151