VTK  9.0.1
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 =========================================================================*/
49 #ifndef vtkClipClosedSurface_h
50 #define vtkClipClosedSurface_h
51 
52 #include "vtkFiltersGeneralModule.h" // For export macro
53 #include "vtkPolyDataAlgorithm.h"
54 
55 class vtkPlaneCollection;
57 class vtkDoubleArray;
58 class vtkIdTypeArray;
59 class vtkCellArray;
60 class vtkPointData;
61 class vtkCellData;
62 class vtkPolygon;
63 class vtkIdList;
64 class vtkCCSEdgeLocator;
65 
66 enum
67 {
71 };
72 
73 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
74 {
75 public:
76  static vtkClipClosedSurface* New();
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
84  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
85  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
87 
89 
94  vtkSetMacro(Tolerance, double);
95  vtkGetMacro(Tolerance, double);
97 
99 
103  vtkSetMacro(PassPointData, vtkTypeBool);
104  vtkBooleanMacro(PassPointData, vtkTypeBool);
105  vtkGetMacro(PassPointData, vtkTypeBool);
107 
109 
113  vtkSetMacro(GenerateOutline, vtkTypeBool);
114  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
115  vtkGetMacro(GenerateOutline, vtkTypeBool);
117 
119 
123  vtkSetMacro(GenerateFaces, vtkTypeBool);
124  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
125  vtkGetMacro(GenerateFaces, vtkTypeBool);
127 
129 
138  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
139  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
140  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
141  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
142  vtkGetMacro(ScalarMode, int);
143  const char* GetScalarModeAsString();
145 
147 
153  vtkSetVector3Macro(BaseColor, double);
154  vtkGetVector3Macro(BaseColor, double);
156 
158 
163  vtkSetVector3Macro(ClipColor, double);
164  vtkGetVector3Macro(ClipColor, double);
166 
168 
173  vtkSetMacro(ActivePlaneId, int);
174  vtkGetMacro(ActivePlaneId, int);
176 
178 
183  vtkSetVector3Macro(ActivePlaneColor, double);
184  vtkGetVector3Macro(ActivePlaneColor, double);
186 
188 
194  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
195  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
196  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
198 
199 protected:
201  ~vtkClipClosedSurface() override;
202 
204 
205  double Tolerance;
206 
212  double BaseColor[3];
213  double ClipColor[3];
214  double ActivePlaneColor[3];
215 
217 
219 
220  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inputVector,
221  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
222 
223  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
224  vtkInformationVector* outputVector) override;
225 
229  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
230  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
231  vtkCellData* inCellData, vtkCellData* outLineData);
232 
239  void ClipAndContourPolys(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
240  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
241  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inPolyData,
242  vtkCellData* outPolyData, vtkCellData* outLineData);
243 
250  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
251  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
252  vtkIdType& i);
253 
259  int TriangulatePolygon(vtkIdList* polygon, vtkPoints* points, vtkCellArray* triangles);
260 
270  void TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines,
271  vtkCellArray* outputPolys, const double normal[3]);
272 
279  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
280  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
281  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
282 
288  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
289  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
290  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
291 
296  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
297  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
298  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
299 
305  static void SqueezeOutputPoints(
306  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
307 
311  static void CreateColorValues(const double color1[3], const double color2[3],
312  const double color3[3], unsigned char colors[3][3]);
313 
314 private:
316  void operator=(const vtkClipClosedSurface&) = delete;
317 };
318 
319 #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:31
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
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:338
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
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:33
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:30
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:179
Store zero or more vtkInformation instances.
vtkPlaneCollection * ClippingPlanes
represent and manipulate 3D points
Definition: vtkPoints.h:33
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.