VTK  9.3.1
vtkCutter.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
40 #ifndef vtkCutter_h
41 #define vtkCutter_h
42 
43 #include "vtkFiltersCoreModule.h" // For export macro
44 #include "vtkPolyDataAlgorithm.h"
45 
46 #include "vtkContourValues.h" // Needed for inline methods
47 
48 #define VTK_SORT_BY_VALUE 0
49 #define VTK_SORT_BY_CELL 1
50 
51 VTK_ABI_NAMESPACE_BEGIN
55 class vtkPlaneCutter;
59 
60 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
61 {
62 public:
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70  static vtkCutter* New();
71 
76  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
77 
81  double GetValue(int i) { return this->ContourValues->GetValue(i); }
82 
87  double* GetValues() { return this->ContourValues->GetValues(); }
88 
94  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
95 
101  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
102 
106  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
107 
112  void GenerateValues(int numContours, double range[2])
113  {
114  this->ContourValues->GenerateValues(numContours, range);
115  }
116 
121  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
122  {
123  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
124  }
125 
130  vtkMTimeType GetMTime() override;
131 
133 
136  virtual void SetCutFunction(vtkImplicitFunction*);
137  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
139 
141 
146  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
147  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
148  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
150 
152 
159  vtkSetMacro(GenerateTriangles, vtkTypeBool);
160  vtkGetMacro(GenerateTriangles, vtkTypeBool);
161  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
163 
165 
169  void SetLocator(vtkIncrementalPointLocator* locator);
170  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
172 
174 
189  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
190  vtkGetMacro(SortBy, int);
191  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
192  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
193  const char* GetSortByAsString();
195 
200  void CreateDefaultLocator();
201 
207  static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
208 
210 
215  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
216  vtkGetMacro(OutputPointsPrecision, int);
218 
219 protected:
220  vtkCutter(vtkImplicitFunction* cf = nullptr);
221  ~vtkCutter() override;
222 
225  int FillInputPortInformation(int port, vtkInformation* info) override;
226  void UnstructuredGridCutter(vtkDataSet* input, vtkPolyData* output);
227  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
228  void StructuredPointsCutter(
230  void StructuredGridCutter(vtkDataSet*, vtkPolyData*);
231  void RectilinearGridCutter(vtkDataSet*, vtkPolyData*);
234 
240 
242  int SortBy;
246 
247 private:
248  vtkCutter(const vtkCutter&) = delete;
249  void operator=(const vtkCutter&) = delete;
250 };
251 
255 inline const char* vtkCutter::GetSortByAsString()
256 {
257  if (this->SortBy == VTK_SORT_BY_VALUE)
258  {
259  return "SortByValue";
260  }
261  else
262  {
263  return "SortByCell";
264  }
265 }
266 
267 VTK_ABI_NAMESPACE_END
268 #endif
abstract interface for implicit functions
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:60
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
Definition: vtkCutter.h:238
double GetValue(int i)
Get the ith contour value.
Definition: vtkCutter.h:81
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
generate isosurface from structured grids
Abstract class in support of both point location and point insertion.
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
Definition: vtkCutter.h:237
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:241
int SortBy
Definition: vtkCutter.h:242
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:112
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:232
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:233
generate cut surface from structured points
generate isosurface from structured points
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkNew< vtkPlaneCutter > PlaneCutter
Definition: vtkCutter.h:239
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
cut any dataset with a plane and generate a polygonal cut surface
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:106
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetSortByToSortByCell()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:192
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:244
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D
Definition: vtkCutter.h:235
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:48
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:101
generate isosurface from rectilinear grid
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:191
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Definition: vtkCutter.h:76
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:49
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:255
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:121
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:94
int OutputPointsPrecision
Definition: vtkCutter.h:245
vtkNew< vtkContourValues > ContourValues
Definition: vtkCutter.h:243
vtkNew< vtkSynchronizedTemplatesCutter3D > SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:236
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:87
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.