VTK  9.3.0
vtkGeometryFilter.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
90 #ifndef vtkGeometryFilter_h
91 #define vtkGeometryFilter_h
92 
93 #include "vtkFiltersGeometryModule.h" // For export macro
94 #include "vtkPolyDataAlgorithm.h"
95 
96 #include <array> // For std::array
97 
98 VTK_ABI_NAMESPACE_BEGIN
100 class vtkStructuredGrid;
102 class vtkGeometryFilter;
105 
106 // Used to coordinate delegation to vtkDataSetSurfaceFilter
107 struct VTKFILTERSGEOMETRY_EXPORT vtkGeometryFilterHelper
108 {
109  enum CellType
110  {
111  VERTS = 0,
112  LINES = 1,
113  POLYS = 2,
114  STRIPS = 3,
115  OTHER_LINEAR_CELLS = 4,
116  NON_LINEAR_CELLS = 5,
117  NUM_CELL_TYPES
118  };
119  using CellTypesInformation = std::array<bool, NUM_CELL_TYPES>;
121  unsigned char IsLinear;
126  {
127  return this->CellTypesInfo[VERTS] && !this->CellTypesInfo[LINES] &&
128  !this->CellTypesInfo[POLYS] && !this->CellTypesInfo[STRIPS] &&
129  !this->CellTypesInfo[OTHER_LINEAR_CELLS] && !this->CellTypesInfo[NON_LINEAR_CELLS];
130  }
132  {
133  return !this->CellTypesInfo[VERTS] && this->CellTypesInfo[LINES] &&
134  !this->CellTypesInfo[POLYS] && !this->CellTypesInfo[STRIPS] &&
135  !this->CellTypesInfo[OTHER_LINEAR_CELLS] && !this->CellTypesInfo[NON_LINEAR_CELLS];
136  }
138  {
139  return !this->CellTypesInfo[VERTS] && !this->CellTypesInfo[LINES] &&
140  this->CellTypesInfo[POLYS] && !this->CellTypesInfo[STRIPS] &&
141  !this->CellTypesInfo[OTHER_LINEAR_CELLS] && !this->CellTypesInfo[NON_LINEAR_CELLS];
142  }
144  {
145  return !this->CellTypesInfo[VERTS] && !this->CellTypesInfo[LINES] &&
146  !this->CellTypesInfo[POLYS] && this->CellTypesInfo[STRIPS] &&
147  !this->CellTypesInfo[OTHER_LINEAR_CELLS] && !this->CellTypesInfo[NON_LINEAR_CELLS];
148  }
149 };
150 
151 class VTKFILTERSGEOMETRY_EXPORT vtkGeometryFilter : public vtkPolyDataAlgorithm
152 {
153 public:
155 
160  void PrintSelf(ostream& os, vtkIndent indent) override;
162 
164 
167  vtkSetMacro(PointClipping, bool);
168  vtkGetMacro(PointClipping, bool);
169  vtkBooleanMacro(PointClipping, bool);
171 
173 
176  vtkSetMacro(CellClipping, bool);
177  vtkGetMacro(CellClipping, bool);
178  vtkBooleanMacro(CellClipping, bool);
180 
182 
185  vtkSetMacro(ExtentClipping, bool);
186  vtkGetMacro(ExtentClipping, bool);
187  vtkBooleanMacro(ExtentClipping, bool);
189 
191 
194  vtkSetClampMacro(PointMinimum, vtkIdType, 0, VTK_ID_MAX);
195  vtkGetMacro(PointMinimum, vtkIdType);
197 
199 
202  vtkSetClampMacro(PointMaximum, vtkIdType, 0, VTK_ID_MAX);
203  vtkGetMacro(PointMaximum, vtkIdType);
205 
207 
210  vtkSetClampMacro(CellMinimum, vtkIdType, 0, VTK_ID_MAX);
211  vtkGetMacro(CellMinimum, vtkIdType);
213 
215 
218  vtkSetClampMacro(CellMaximum, vtkIdType, 0, VTK_ID_MAX);
219  vtkGetMacro(CellMaximum, vtkIdType);
221 
225  void SetExtent(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
226 
228 
231  void SetExtent(double extent[6]);
232  double* GetExtent() VTK_SIZEHINT(6) { return this->Extent; }
234 
236 
244  vtkSetMacro(Merging, bool);
245  vtkGetMacro(Merging, bool);
246  vtkBooleanMacro(Merging, bool);
248 
250 
257  void SetOutputPointsPrecision(int precision);
260 
262 
269  vtkSetMacro(FastMode, bool);
270  vtkGetMacro(FastMode, bool);
271  vtkBooleanMacro(FastMode, bool);
273 
275 
282  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
283  virtual void SetDegree(unsigned int vtkNotUsed(arg)) {}
284  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
285  virtual unsigned int GetDegreeMinValue() { return 1; }
286  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
287  virtual unsigned int GetDegreeMaxValue() { return static_cast<int>(~0u >> 1); }
288  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
289  virtual unsigned int GetDegree() { return 4; }
291 
293 
298  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
299  void SetLocator(vtkIncrementalPointLocator* locator);
300  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
301  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
303 
308  VTK_DEPRECATED_IN_9_2_0("This method is no longer used and has no effect.")
309  void CreateDefaultLocator();
310 
311  // The following are methods compatible with vtkDataSetSurfaceFilter.
312 
314 
319  vtkSetMacro(PieceInvariant, int);
320  vtkGetMacro(PieceInvariant, int);
322 
324 
331  vtkSetMacro(PassThroughCellIds, vtkTypeBool);
332  vtkGetMacro(PassThroughCellIds, vtkTypeBool);
333  vtkBooleanMacro(PassThroughCellIds, vtkTypeBool);
335 
337 
344  vtkSetMacro(PassThroughPointIds, vtkTypeBool);
345  vtkGetMacro(PassThroughPointIds, vtkTypeBool);
346  vtkBooleanMacro(PassThroughPointIds, vtkTypeBool);
348 
350 
356  vtkSetStringMacro(OriginalCellIdsName);
357  virtual const char* GetOriginalCellIdsName()
358  {
359  return (this->OriginalCellIdsName ? this->OriginalCellIdsName : "vtkOriginalCellIds");
360  }
361  vtkSetStringMacro(OriginalPointIdsName);
362  virtual const char* GetOriginalPointIdsName()
363  {
364  return (this->OriginalPointIdsName ? this->OriginalPointIdsName : "vtkOriginalPointIds");
365  }
367 
369 
384 
386 
397  vtkSetMacro(NonlinearSubdivisionLevel, int);
398  vtkGetMacro(NonlinearSubdivisionLevel, int);
400 
402 
405  vtkSetMacro(Delegation, vtkTypeBool);
406  vtkGetMacro(Delegation, vtkTypeBool);
407  vtkBooleanMacro(Delegation, vtkTypeBool);
409 
411 
422  vtkSetMacro(RemoveGhostInterfaces, bool);
423  vtkBooleanMacro(RemoveGhostInterfaces, bool);
424  vtkGetMacro(RemoveGhostInterfaces, bool);
426 
428 
433  int PolyDataExecute(vtkDataSet* input, vtkPolyData* output, vtkPolyData* exc);
435 
438  virtual int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output);
439 
440  VTK_DEPRECATED_IN_9_3_0("Use the new version that has int* instead of vtkInformation*")
441  int StructuredExecute(vtkDataSet* input, vtkPolyData* output, vtkInformation* inInfo,
442  vtkPolyData* exc, bool* extractFace = nullptr);
443  int StructuredExecute(vtkDataSet* input, vtkPolyData* output, int* wholeExtent, vtkPolyData* exc,
444  bool* extractFace = nullptr);
445  VTK_DEPRECATED_IN_9_3_0("Use the new version that has int* instead of vtkInformation*")
446  virtual int StructuredExecute(
447  vtkDataSet* input, vtkPolyData* output, vtkInformation* inInfo, bool* extractFace = nullptr);
448  virtual int StructuredExecute(
449  vtkDataSet* input, vtkPolyData* output, int* wholeExt, bool* extractFace = nullptr);
450 
451  int DataSetExecute(vtkDataSet* input, vtkPolyData* output, vtkPolyData* exc);
452  virtual int DataSetExecute(vtkDataSet* input, vtkPolyData* output);
454 
455 protected:
457  ~vtkGeometryFilter() override;
458 
460  int FillInputPortInformation(int port, vtkInformation* info) override;
461 
462  // special cases for performance
463  int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
464 
465  vtkIdType PointMaximum;
466  vtkIdType PointMinimum;
467  vtkIdType CellMinimum;
468  vtkIdType CellMaximum;
469  double Extent[6];
470  bool PointClipping;
471  bool CellClipping;
472  bool ExtentClipping;
473  int OutputPointsPrecision;
474  bool RemoveGhostInterfaces;
475 
476  bool Merging;
478 
479  bool FastMode;
480 
481  // These methods support compatibility with vtkDataSetSurfaceFilter
482  int PieceInvariant;
483  vtkTypeBool PassThroughCellIds;
484  char* OriginalCellIdsName;
485 
486  vtkTypeBool PassThroughPointIds;
487  char* OriginalPointIdsName;
488 
489  int NonlinearSubdivisionLevel;
490 
491  vtkTypeBool Delegation;
492 
493 private:
494  vtkGeometryFilter(const vtkGeometryFilter&) = delete;
495  void operator=(const vtkGeometryFilter&) = delete;
496 };
497 
498 VTK_ABI_NAMESPACE_END
499 #endif
Proxy object to connect input/output ports.
Extracts outer surface (as vtkPolyData) of any dataset.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
extract boundary geometry from dataset (or convert data to polygonal type)
virtual int PolyDataExecute(vtkDataSet *, vtkPolyData *)
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
double * GetExtent()
Set / get a (xmin,xmax, ymin,ymax, zmin,zmax) bounding box to clip data.
int GetOutputPointsPrecision() const
Set/get the desired precision for the output types.
void SetOutputPointsPrecision(int precision)
Set/get the desired precision for the output types.
virtual const char * GetOriginalPointIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
vtkPolyData * GetExcludedFaces()
If a second, vtkPolyData input is provided, this second input specifies a list of faces to be exclude...
static vtkGeometryFilter * New()
Standard methods for instantiation, type information, and printing.
int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output, vtkGeometryFilterHelper *info, vtkPolyData *exc)
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
virtual int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output)
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
void SetExcludedFacesConnection(vtkAlgorithmOutput *algOutput)
If a second, vtkPolyData input is provided, this second input specifies a list of faces to be exclude...
int PolyDataExecute(vtkDataSet *input, vtkPolyData *output, vtkPolyData *exc)
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
void SetExtent(double extent[6])
Set / get a (xmin,xmax, ymin,ymax, zmin,zmax) bounding box to clip data.
void SetExcludedFacesData(vtkPolyData *)
If a second, vtkPolyData input is provided, this second input specifies a list of faces to be exclude...
void SetExtent(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
Specify a (xmin,xmax, ymin,ymax, zmin,zmax) bounding box to clip data.
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:38
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:89
topologically regular array of data
dataset represents arbitrary combinations of all possible cell types.
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ extent
Definition: vtkX3D.h:345
@ version
Definition: vtkX3D.h:526
CellTypesInformation CellTypesInfo
static void CopyFilterParams(vtkDataSetSurfaceFilter *dssf, vtkGeometryFilter *gf)
std::array< bool, NUM_CELL_TYPES > CellTypesInformation
static void CopyFilterParams(vtkGeometryFilter *gf, vtkDataSetSurfaceFilter *dssf)
static vtkGeometryFilterHelper * CharacterizeUnstructuredGrid(vtkUnstructuredGridBase *)
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_3_0(reason)
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:315
#define VTK_ID_MAX
Definition: vtkType.h:319
#define VTK_SIZEHINT(...)