VTK  9.2.5
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 =========================================================================*/
154 #ifndef vtkCutter_h
155 #define vtkCutter_h
156 
157 #include "vtkFiltersCoreModule.h" // For export macro
158 #include "vtkPolyDataAlgorithm.h"
159 
160 #include "vtkContourValues.h" // Needed for inline methods
161 
162 #define VTK_SORT_BY_VALUE 0
163 #define VTK_SORT_BY_CELL 1
164 
165 class vtkImplicitFunction;
171 
172 class VTKFILTERSCORE_EXPORT vtkCutter : public vtkPolyDataAlgorithm
173 {
174 public:
176  void PrintSelf(ostream& os, vtkIndent indent) override;
177 
182  static vtkCutter* New();
183 
188  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
189 
193  double GetValue(int i) { return this->ContourValues->GetValue(i); }
194 
199  double* GetValues() { return this->ContourValues->GetValues(); }
200 
206  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
207 
213  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
214 
218  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
219 
224  void GenerateValues(int numContours, double range[2])
225  {
226  this->ContourValues->GenerateValues(numContours, range);
227  }
228 
233  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
234  {
235  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
236  }
237 
242  vtkMTimeType GetMTime() override;
243 
245 
249  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
251 
253 
258  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
259  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
260  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
262 
264 
271  vtkSetMacro(GenerateTriangles, vtkTypeBool);
272  vtkGetMacro(GenerateTriangles, vtkTypeBool);
273  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
275 
277 
282  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
284 
286 
301  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
302  vtkGetMacro(SortBy, int);
303  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
304  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
305  const char* GetSortByAsString();
307 
313 
319  static void GetCellTypeDimensions(unsigned char* cellTypeDimensions);
320 
322 
327  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
328  vtkGetMacro(OutputPointsPrecision, int);
330 
331 protected:
333  ~vtkCutter() override;
334 
339  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
346 
351 
353  int SortBy;
357 
358 private:
359  vtkCutter(const vtkCutter&) = delete;
360  void operator=(const vtkCutter&) = delete;
361 };
362 
366 inline const char* vtkCutter::GetSortByAsString()
367 {
368  if (this->SortBy == VTK_SORT_BY_VALUE)
369  {
370  return "SortByValue";
371  }
372  else
373  {
374  return "SortByCell";
375  }
376 }
377 
378 #endif
helper object to manage setting and generating contour values
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:173
void StructuredGridCutter(vtkDataSet *, vtkPolyData *)
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:366
vtkContourValues * ContourValues
Definition: vtkCutter.h:354
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:206
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void CreateDefaultLocator()
Create default locator.
vtkSynchronizedTemplates3D * SynchronizedTemplates3D
Definition: vtkCutter.h:347
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:218
vtkSynchronizedTemplatesCutter3D * SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:348
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:213
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:224
int SortBy
Definition: vtkCutter.h:353
vtkGridSynchronizedTemplates3D * GridSynchronizedTemplates
Definition: vtkCutter.h:349
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:352
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:344
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:304
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:355
void StructuredPointsCutter(vtkDataSet *, vtkPolyData *, vtkInformation *, vtkInformationVector **, vtkInformationVector *)
~vtkCutter() override
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:199
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:188
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:345
void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output)
int OutputPointsPrecision
Definition: vtkCutter.h:356
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:303
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:233
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:193
vtkRectilinearSynchronizedTemplates * RectilinearSynchronizedTemplates
Definition: vtkCutter.h:350
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
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:119
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:200
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:162
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:163
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287