VTK  9.5.20250805
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
139#ifndef vtkCutter_h
140#define vtkCutter_h
141
142#include "vtkFiltersCoreModule.h" // For export macro
143#include "vtkPolyDataAlgorithm.h"
144
145#include "vtkContourValues.h" // Needed for inline methods
146
147#define VTK_SORT_BY_VALUE 0
148#define VTK_SORT_BY_CELL 1
149
150VTK_ABI_NAMESPACE_BEGIN
154class vtkPlaneCutter;
158
159class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
160{
161public:
163 void PrintSelf(ostream& os, vtkIndent indent) override;
164
169 static vtkCutter* New();
170
175 void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
176
180 double GetValue(int i) { return this->ContourValues->GetValue(i); }
181
186 double* GetValues() { return this->ContourValues->GetValues(); }
187
193 void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
194
200 void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
201
205 vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
206
211 void GenerateValues(int numContours, double range[2])
212 {
213 this->ContourValues->GenerateValues(numContours, range);
214 }
215
220 void GenerateValues(int numContours, double rangeStart, double rangeEnd)
221 {
222 this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
223 }
224
230
232
236 vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
238
240
245 vtkSetMacro(GenerateCutScalars, vtkTypeBool);
246 vtkGetMacro(GenerateCutScalars, vtkTypeBool);
247 vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
249
251
258 vtkSetMacro(GenerateTriangles, vtkTypeBool);
259 vtkGetMacro(GenerateTriangles, vtkTypeBool);
260 vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
262
264
269 vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
271
273
288 vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
289 vtkGetMacro(SortBy, int);
290 void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
291 void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
292 const char* GetSortByAsString();
294
300
302
307 vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
308 vtkGetMacro(OutputPointsPrecision, int);
310
311protected:
313 ~vtkCutter() override;
314
317 int FillInputPortInformation(int port, vtkInformation* info) override;
319 void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
326
332
338
339 // Garbage collection method
341
342private:
343 vtkCutter(const vtkCutter&) = delete;
344 void operator=(const vtkCutter&) = delete;
345};
346
351{
352 if (this->SortBy == VTK_SORT_BY_VALUE)
353 {
354 return "SortByValue";
355 }
356 else
357 {
358 return "SortByCell";
359 }
360}
361
362VTK_ABI_NAMESPACE_END
363#endif
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:160
vtkNew< vtkPlaneCutter > PlaneCutter
Definition vtkCutter.h:331
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
Definition vtkCutter.h:330
void StructuredGridCutter(vtkDataSet *, vtkPolyData *)
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition vtkCutter.h:350
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:193
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:205
vtkNew< vtkContourValues > ContourValues
Definition vtkCutter.h:335
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D
Definition vtkCutter.h:327
static vtkCutter * New()
Construct with user-specified implicit function; initial value of 0.0; and generating cut scalars tur...
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition vtkCutter.h:200
double * GetValues()
Get a pointer to an array of contour values.
Definition vtkCutter.h:186
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:211
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkIncrementalPointLocator * Locator
Definition vtkCutter.h:333
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
Definition vtkCutter.h:329
vtkImplicitFunction * CutFunction
Definition vtkCutter.h:324
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:291
vtkTypeBool GenerateCutScalars
Definition vtkCutter.h:336
void StructuredPointsCutter(vtkDataSet *, vtkPolyData *, vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void ReportReferences(vtkGarbageCollector *) override
~vtkCutter() override
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Definition vtkCutter.h:175
vtkTypeBool GenerateTriangles
Definition vtkCutter.h:325
void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output)
int OutputPointsPrecision
Definition vtkCutter.h:337
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition vtkCutter.h:290
vtkNew< vtkSynchronizedTemplatesCutter3D > SynchronizedTemplatesCutter3D
Definition vtkCutter.h:328
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:220
void RectilinearGridCutter(vtkDataSet *, vtkPolyData *)
double GetValue(int i)
Get the ith contour value.
Definition vtkCutter.h:180
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
Detect and break reference loops.
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:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
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
generate isosurface from rectilinear grid
generate isosurface from structured points
generate cut surface from structured points
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SORT_BY_VALUE
Definition vtkCutter.h:147
#define VTK_SORT_BY_CELL
Definition vtkCutter.h:148
int vtkIdType
Definition vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287