VTK  9.0.3
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 =========================================================================*/
45 #ifndef vtkCutter_h
46 #define vtkCutter_h
47 
48 #include "vtkFiltersCoreModule.h" // For export macro
49 #include "vtkPolyDataAlgorithm.h"
50 
51 #include "vtkContourValues.h" // Needed for inline methods
52 
53 #define VTK_SORT_BY_VALUE 0
54 #define VTK_SORT_BY_CELL 1
55 
62 
63 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
64 {
65 public:
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
73  static vtkCutter* New();
74 
79  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
80 
84  double GetValue(int i) { return this->ContourValues->GetValue(i); }
85 
90  double* GetValues() { return this->ContourValues->GetValues(); }
91 
97  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
98 
104  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
105 
109  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
110 
115  void GenerateValues(int numContours, double range[2])
116  {
117  this->ContourValues->GenerateValues(numContours, range);
118  }
119 
124  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
125  {
126  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
127  }
128 
133  vtkMTimeType GetMTime() override;
134 
136 
140  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
142 
144 
149  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
150  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
151  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
153 
155 
162  vtkSetMacro(GenerateTriangles, vtkTypeBool);
163  vtkGetMacro(GenerateTriangles, vtkTypeBool);
164  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
166 
168 
173  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
175 
177 
192  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
193  vtkGetMacro(SortBy, int);
194  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
195  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
196  const char* GetSortByAsString();
198 
204 
210  static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
211 
213 
218  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
219  vtkGetMacro(OutputPointsPrecision, int);
221 
222 protected:
224  ~vtkCutter() override;
225 
230  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
237 
242 
244  int SortBy;
248 
249 private:
250  vtkCutter(const vtkCutter&) = delete;
251  void operator=(const vtkCutter&) = delete;
252 };
253 
255 
258 inline const char* vtkCutter::GetSortByAsString(void)
259 {
260  if (this->SortBy == VTK_SORT_BY_VALUE)
261  {
262  return "SortByValue";
263  }
264  else
265  {
266  return "SortByCell";
267  }
268 }
270 
271 #endif
helper object to manage setting and generating contour values
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:64
void StructuredGridCutter(vtkDataSet *, vtkPolyData *)
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:258
vtkContourValues * ContourValues
Definition: vtkCutter.h:245
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:97
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void CreateDefaultLocator()
Create default locator.
vtkSynchronizedTemplates3D * SynchronizedTemplates3D
Definition: vtkCutter.h:238
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:109
vtkSynchronizedTemplatesCutter3D * SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:239
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:104
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:115
int SortBy
Definition: vtkCutter.h:244
vtkGridSynchronizedTemplates3D * GridSynchronizedTemplates
Definition: vtkCutter.h:240
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:243
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:235
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetSortByToSortByCell()
Definition: vtkCutter.h:195
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:246
void StructuredPointsCutter(vtkDataSet *, vtkPolyData *, vtkInformation *, vtkInformationVector **, vtkInformationVector *)
~vtkCutter() override
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:90
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:79
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:236
void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output)
int OutputPointsPrecision
Definition: vtkCutter.h:247
void SetSortByToSortByValue()
Definition: vtkCutter.h:194
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:124
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:84
vtkRectilinearSynchronizedTemplates * RectilinearSynchronizedTemplates
Definition: vtkCutter.h:241
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
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:34
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:85
generate isosurface from rectilinear grid
generate isosurface from structured points
generate cut surface from structured points
@ info
Definition: vtkX3D.h:382
@ value
Definition: vtkX3D.h:226
@ port
Definition: vtkX3D.h:453
@ range
Definition: vtkX3D.h:244
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:53
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:54
int vtkIdType
Definition: vtkType.h:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293