VTK  9.2.6
vtkCutter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCutter.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 =========================================================================*/
55 #ifndef vtkCutter_h
56 #define vtkCutter_h
57 
58 #include "vtkFiltersCoreModule.h" // For export macro
59 #include "vtkPolyDataAlgorithm.h"
60 
61 #include "vtkContourValues.h" // Needed for inline methods
62 
63 #define VTK_SORT_BY_VALUE 0
64 #define VTK_SORT_BY_CELL 1
65 
72 
73 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
74 {
75 public:
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
83  static vtkCutter* New();
84 
89  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
90 
94  double GetValue(int i) { return this->ContourValues->GetValue(i); }
95 
100  double* GetValues() { return this->ContourValues->GetValues(); }
101 
107  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
108 
114  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
115 
119  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
120 
125  void GenerateValues(int numContours, double range[2])
126  {
127  this->ContourValues->GenerateValues(numContours, range);
128  }
129 
134  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
135  {
136  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
137  }
138 
143  vtkMTimeType GetMTime() override;
144 
146 
149  virtual void SetCutFunction(vtkImplicitFunction*);
150  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
152 
154 
159  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
160  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
161  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
163 
165 
172  vtkSetMacro(GenerateTriangles, vtkTypeBool);
173  vtkGetMacro(GenerateTriangles, vtkTypeBool);
174  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
176 
178 
182  void SetLocator(vtkIncrementalPointLocator* locator);
183  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
185 
187 
202  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
203  vtkGetMacro(SortBy, int);
204  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
205  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
206  const char* GetSortByAsString();
208 
213  void CreateDefaultLocator();
214 
220  static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
221 
223 
228  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
229  vtkGetMacro(OutputPointsPrecision, int);
231 
232 protected:
233  vtkCutter(vtkImplicitFunction* cf = nullptr);
234  ~vtkCutter() override;
235 
238  int FillInputPortInformation(int port, vtkInformation* info) override;
239  void UnstructuredGridCutter(vtkDataSet* input, vtkPolyData* output);
240  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
241  void StructuredPointsCutter(
243  void StructuredGridCutter(vtkDataSet*, vtkPolyData*);
244  void RectilinearGridCutter(vtkDataSet*, vtkPolyData*);
247 
252 
254  int SortBy;
258 
259 private:
260  vtkCutter(const vtkCutter&) = delete;
261  void operator=(const vtkCutter&) = delete;
262 };
263 
267 inline const char* vtkCutter::GetSortByAsString()
268 {
269  if (this->SortBy == VTK_SORT_BY_VALUE)
270  {
271  return "SortByValue";
272  }
273  else
274  {
275  return "SortByCell";
276  }
277 }
278 
279 #endif
abstract interface for implicit functions
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:73
helper object to manage setting and generating contour values
double GetValue(int i)
Get the ith contour value.
Definition: vtkCutter.h:94
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
generate isosurface from structured grids
vtkRectilinearSynchronizedTemplates * RectilinearSynchronizedTemplates
Definition: vtkCutter.h:251
Abstract class in support of both point location and point insertion.
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:253
int SortBy
Definition: vtkCutter.h:254
vtkGridSynchronizedTemplates3D * GridSynchronizedTemplates
Definition: vtkCutter.h:250
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:125
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:245
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:246
generate cut surface from structured points
generate isosurface from structured points
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Superclass for algorithms that produce only polydata as output.
vtkSynchronizedTemplatesCutter3D * SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:249
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:119
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetSortByToSortByCell()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:205
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:256
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:63
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:114
generate isosurface from rectilinear grid
vtkContourValues * ContourValues
Definition: vtkCutter.h:255
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:204
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Definition: vtkCutter.h:89
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:64
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:267
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:134
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
void GetValues(double *contourValues)
Fill a supplied list with contour values.
Definition: vtkCutter.h:107
int OutputPointsPrecision
Definition: vtkCutter.h:257
vtkSynchronizedTemplates3D * SynchronizedTemplates3D
Definition: vtkCutter.h:248
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:100
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.