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) 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, vtkTypeBool);
106  vtkBooleanMacro(PassPointData, vtkTypeBool);
107  vtkGetMacro(PassPointData, vtkTypeBool);
109 
111 
115  vtkSetMacro(GenerateOutline, vtkTypeBool);
116  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
117  vtkGetMacro(GenerateOutline, vtkTypeBool);
119 
121 
125  vtkSetMacro(GenerateFaces, vtkTypeBool);
126  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
127  vtkGetMacro(GenerateFaces, vtkTypeBool);
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, vtkTypeBool);
201  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
202  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
204 
205 protected:
207  ~vtkClipClosedSurface() override;
208 
210 
211  double Tolerance;
212 
218  double BaseColor[3];
219  double ClipColor[3];
220  double ActivePlaneColor[3];
221 
223 
225 
227  vtkInformation* request, vtkInformationVector** inputVector,
228  vtkInformationVector* outputVector, int requestFromOutputPort,
229  vtkMTimeType* mtime) override;
230 
231  int RequestData(
232  vtkInformation* request, vtkInformationVector** inputVector,
233  vtkInformationVector* outputVector) 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:
337  void operator=(const vtkClipClosedSurface&) = delete;
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.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
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:347
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
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:36
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:45
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:50
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.