VTK  9.2.6
vtkClipClosedSurface.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkClipClosedSurface.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 =========================================================================*/
55 #ifndef vtkClipClosedSurface_h
56 #define vtkClipClosedSurface_h
57 
58 #include "vtkFiltersGeneralModule.h" // For export macro
59 #include "vtkPolyDataAlgorithm.h"
60 
61 class vtkPlaneCollection;
63 class vtkDoubleArray;
64 class vtkIdTypeArray;
65 class vtkCellArray;
66 class vtkPointData;
67 class vtkCellData;
68 class vtkPolygon;
69 class vtkIdList;
70 class vtkCCSEdgeLocator;
71 
72 enum
73 {
77 };
78 
79 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
80 {
81 public:
83 
86  static vtkClipClosedSurface* New();
88  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
92 
95  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
96  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
98 
100 
105  vtkSetMacro(Tolerance, double);
106  vtkGetMacro(Tolerance, double);
108 
110 
114  vtkSetMacro(PassPointData, vtkTypeBool);
115  vtkBooleanMacro(PassPointData, vtkTypeBool);
116  vtkGetMacro(PassPointData, vtkTypeBool);
118 
120 
124  vtkSetMacro(GenerateOutline, vtkTypeBool);
125  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
126  vtkGetMacro(GenerateOutline, vtkTypeBool);
128 
130 
134  vtkSetMacro(GenerateFaces, vtkTypeBool);
135  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
136  vtkGetMacro(GenerateFaces, vtkTypeBool);
138 
140 
149  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
150  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
151  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
152  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
153  vtkGetMacro(ScalarMode, int);
154  const char* GetScalarModeAsString();
156 
158 
164  vtkSetVector3Macro(BaseColor, double);
165  vtkGetVector3Macro(BaseColor, double);
167 
169 
174  vtkSetVector3Macro(ClipColor, double);
175  vtkGetVector3Macro(ClipColor, double);
177 
179 
184  vtkSetMacro(ActivePlaneId, int);
185  vtkGetMacro(ActivePlaneId, int);
187 
189 
194  vtkSetVector3Macro(ActivePlaneColor, double);
195  vtkGetVector3Macro(ActivePlaneColor, double);
197 
199 
205  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
206  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
207  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
209 
210 protected:
212  ~vtkClipClosedSurface() override;
213 
215 
216  double Tolerance;
217 
223  double BaseColor[3];
224  double ClipColor[3];
225  double ActivePlaneColor[3];
226 
228 
230 
231  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inputVector,
232  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
233 
234  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
235  vtkInformationVector* outputVector) override;
236 
240  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
241  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
242  vtkCellData* inCellData, vtkCellData* outLineData);
243 
250  void ClipAndContourPolys(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
251  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
252  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inCellData,
253  vtkCellData* outPolyData, vtkCellData* outLineData);
254 
261  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
262  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
263  vtkIdType& i);
264 
270  int TriangulatePolygon(vtkIdList* polygon, vtkPoints* points, vtkCellArray* triangles);
271 
281  void TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines,
282  vtkCellArray* outputPolys, const double normal[3]);
283 
290  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
291  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
292  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
293 
299  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
300  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
301  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
302 
307  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
308  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
309  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
310 
316  static void SqueezeOutputPoints(
317  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
318 
322  static void CreateColorValues(const double color1[3], const double color2[3],
323  const double color3[3], unsigned char colors[3][3]);
324 
325 private:
327  void operator=(const vtkClipClosedSurface&) = delete;
328 };
329 
330 #endif
void SetScalarModeToColors()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
void SetScalarModeToNone()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
represent and manipulate point attribute data
Definition: vtkPointData.h:41
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
represent and manipulate cell attribute data
Definition: vtkCellData.h:41
maintain a list of planes
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
A special version of ProcessRequest meant specifically for the pipeline modified time request...
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
vtkTypeBool TriangulationErrorDisplay
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetScalarModeToLabels()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
list of point or cell ids
Definition: vtkIdList.h:33
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:42
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:186
Store zero or more vtkInformation instances.
vtkPlaneCollection * ClippingPlanes
represent and manipulate 3D points
Definition: vtkPoints.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Clip a closed surface with a plane collection.