VTK
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 =========================================================================*/
52 #ifndef vtkClipClosedSurface_h
53 #define vtkClipClosedSurface_h
54 
55 #include "vtkFiltersGeneralModule.h" // For export macro
56 #include "vtkPolyDataAlgorithm.h"
57 
58 class vtkPlaneCollection;
60 class vtkDoubleArray;
61 class vtkIdTypeArray;
62 class vtkCellArray;
63 class vtkPointData;
64 class vtkCellData;
65 class vtkPolygon;
66 class vtkIdList;
67 class vtkCCSEdgeLocator;
68 
69 enum {
73 };
74 
75 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
76 {
77 public:
78  static vtkClipClosedSurface *New();
80  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
81 
83 
86  virtual void SetClippingPlanes(vtkPlaneCollection *planes);
87  vtkGetObjectMacro(ClippingPlanes,vtkPlaneCollection);
89 
91 
96  vtkSetMacro(Tolerance, double);
97  vtkGetMacro(Tolerance, double);
99 
101 
105  vtkSetMacro(PassPointData, int);
106  vtkBooleanMacro(PassPointData, int);
107  vtkGetMacro(PassPointData, int);
109 
111 
115  vtkSetMacro(GenerateOutline, int);
116  vtkBooleanMacro(GenerateOutline, int);
117  vtkGetMacro(GenerateOutline, int);
119 
121 
125  vtkSetMacro(GenerateFaces, int);
126  vtkBooleanMacro(GenerateFaces, int);
127  vtkGetMacro(GenerateFaces, int);
129 
131 
140  vtkSetClampMacro(ScalarMode, int,
143  this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); };
145  this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); };
147  this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); };
148  vtkGetMacro(ScalarMode, int);
149  const char *GetScalarModeAsString();
151 
153 
159  vtkSetVector3Macro(BaseColor, double);
160  vtkGetVector3Macro(BaseColor, double);
162 
164 
169  vtkSetVector3Macro(ClipColor, double);
170  vtkGetVector3Macro(ClipColor, double);
172 
174 
179  vtkSetMacro(ActivePlaneId, int);
180  vtkGetMacro(ActivePlaneId, int);
182 
184 
189  vtkSetVector3Macro(ActivePlaneColor, double);
190  vtkGetVector3Macro(ActivePlaneColor, double);
192 
194 
200  vtkSetMacro(TriangulationErrorDisplay, int);
201  vtkBooleanMacro(TriangulationErrorDisplay, int);
202  vtkGetMacro(TriangulationErrorDisplay, int);
204 
205 protected:
207  ~vtkClipClosedSurface() VTK_OVERRIDE;
208 
209  vtkPlaneCollection *ClippingPlanes;
210 
211  double Tolerance;
212 
213  int PassPointData;
214  int GenerateOutline;
215  int GenerateFaces;
216  int ActivePlaneId;
217  int ScalarMode;
218  double BaseColor[3];
219  double ClipColor[3];
220  double ActivePlaneColor[3];
221 
222  int TriangulationErrorDisplay;
223 
224  vtkIdList *IdList;
225 
226  int ComputePipelineMTime(
227  vtkInformation* request, vtkInformationVector** inputVector,
228  vtkInformationVector* outputVector, int requestFromOutputPort,
229  vtkMTimeType* mtime) VTK_OVERRIDE;
230 
231  int RequestData(
232  vtkInformation* request, vtkInformationVector** inputVector,
233  vtkInformationVector* outputVector) VTK_OVERRIDE;
234 
238  void ClipLines(
239  vtkPoints *points, vtkDoubleArray *pointScalars,
240  vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator,
241  vtkCellArray *inputCells, vtkCellArray *outputLines,
242  vtkCellData *inCellData, vtkCellData *outLineData);
243 
250  void ClipAndContourPolys(
251  vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData,
252  vtkCCSEdgeLocator *edgeLocator, int triangulate,
253  vtkCellArray *inputCells, vtkCellArray *outputPolys,
254  vtkCellArray *outputLines, vtkCellData *inPolyData,
255  vtkCellData *outPolyData, vtkCellData *outLineData);
256 
263  static int InterpolateEdge(
264  vtkPoints *points, vtkPointData *pointData,
265  vtkCCSEdgeLocator *edgeLocator, double tol,
266  vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i);
267 
273  int TriangulatePolygon(
274  vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles);
275 
285  void TriangulateContours(
286  vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines,
287  vtkCellArray *outputPolys, const double normal[3]);
288 
295  static void BreakPolylines(
296  vtkCellArray *inputLines, vtkCellArray *outputLines,
297  vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar,
298  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
299 
305  static void CopyPolygons(
306  vtkCellArray *inputPolys, vtkCellArray *outputPolys,
307  vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar,
308  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
309 
314  static void BreakTriangleStrips(
315  vtkCellArray *inputStrips, vtkCellArray *outputPolys,
316  vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar,
317  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
318 
324  static void SqueezeOutputPoints(
325  vtkPolyData *output, vtkPoints *points, vtkPointData *pointData,
326  int outputPointDataType);
327 
331  static void CreateColorValues(
332  const double color1[3], const double color2[3], const double color3[3],
333  unsigned char colors[3][3]);
334 
335 private:
336  vtkClipClosedSurface(const vtkClipClosedSurface&) VTK_DELETE_FUNCTION;
337  void operator=(const vtkClipClosedSurface&) VTK_DELETE_FUNCTION;
338 };
339 
340 #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:37
Store vtkAlgorithm input/output information.
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
maintain a list of planes
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
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:36
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:45
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:50
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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.