VTK  9.3.0
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
49 #ifndef vtkCutter_h
50 #define vtkCutter_h
51 
52 #include "vtkFiltersCoreModule.h" // For export macro
53 #include "vtkPolyDataAlgorithm.h"
54 
55 #include "vtkContourValues.h" // Needed for inline methods
56 
57 #define VTK_SORT_BY_VALUE 0
58 #define VTK_SORT_BY_CELL 1
59 
60 VTK_ABI_NAMESPACE_BEGIN
64 class vtkPlaneCutter;
68 
69 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
70 {
71 public:
73  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
79  static vtkCutter* New();
80 
85  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
86 
90  double GetValue(int i) { return this->ContourValues->GetValue(i); }
91 
96  double* GetValues() { return this->ContourValues->GetValues(); }
97 
103  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
104 
110  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
111 
115  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
116 
121  void GenerateValues(int numContours, double range[2])
122  {
123  this->ContourValues->GenerateValues(numContours, range);
124  }
125 
130  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
131  {
132  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
133  }
134 
139  vtkMTimeType GetMTime() override;
140 
142 
146  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
148 
150 
155  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
156  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
157  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
159 
161 
168  vtkSetMacro(GenerateTriangles, vtkTypeBool);
169  vtkGetMacro(GenerateTriangles, vtkTypeBool);
170  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
172 
174 
179  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
181 
183 
198  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
199  vtkGetMacro(SortBy, int);
200  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
201  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
202  const char* GetSortByAsString();
204 
210 
216  static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
217 
219 
224  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
225  vtkGetMacro(OutputPointsPrecision, int);
227 
228 protected:
230  ~vtkCutter() override;
231 
236  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
243 
249 
251  int SortBy;
255 
256 private:
257  vtkCutter(const vtkCutter&) = delete;
258  void operator=(const vtkCutter&) = delete;
259 };
260 
264 inline const char* vtkCutter::GetSortByAsString()
265 {
266  if (this->SortBy == VTK_SORT_BY_VALUE)
267  {
268  return "SortByValue";
269  }
270  else
271  {
272  return "SortByCell";
273  }
274 }
275 
276 VTK_ABI_NAMESPACE_END
277 #endif
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:70
vtkNew< vtkPlaneCutter > PlaneCutter
Definition: vtkCutter.h:248
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
Definition: vtkCutter.h:247
void StructuredGridCutter(vtkDataSet *, vtkPolyData *)
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:264
void DataSetCutter(vtkDataSet *input, vtkPolyData *output)
virtual void SetCutFunction(vtkImplicitFunction *)
Specify the implicit function to perform the cutting.
void SetLocator(vtkIncrementalPointLocator *locator)
Specify a spatial locator for merging points.
void GetValues(double *contourValues)
Fill a supplied list with contour values.
Definition: vtkCutter.h:103
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void CreateDefaultLocator()
Create default locator.
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:115
vtkNew< vtkContourValues > ContourValues
Definition: vtkCutter.h:252
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D
Definition: vtkCutter.h:244
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:110
vtkMTimeType GetMTime() override
Override GetMTime because we delegate to vtkContourValues and refer to vtkImplicitFunction.
vtkCutter(vtkImplicitFunction *cf=nullptr)
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:121
int SortBy
Definition: vtkCutter.h:251
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:250
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
Definition: vtkCutter.h:246
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:241
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetSortByToSortByCell()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:201
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:253
void StructuredPointsCutter(vtkDataSet *, vtkPolyData *, vtkInformation *, vtkInformationVector **, vtkInformationVector *)
~vtkCutter() override
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:96
static vtkCutter * New()
Construct with user-specified implicit function; initial value of 0.0; and generating cut scalars tur...
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Definition: vtkCutter.h:85
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:242
void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output)
int OutputPointsPrecision
Definition: vtkCutter.h:254
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:200
vtkNew< vtkSynchronizedTemplatesCutter3D > SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:245
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:130
void RectilinearGridCutter(vtkDataSet *, vtkPolyData *)
static void GetCellTypeDimensions(unsigned char *cellTypeDimensions)
Normally I would put this in a different class, but since This is a temporary fix until we convert th...
double GetValue(int i)
Get the ith contour value.
Definition: vtkCutter.h:90
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
generate isosurface from structured grids
abstract interface for implicit functions
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.
cut any dataset with a plane and generate a polygonal cut surface
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
generate isosurface from rectilinear grid
generate isosurface from structured points
generate cut surface from structured points
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ range
Definition: vtkX3D.h:238
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:57
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:58
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270