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 =========================================================================*/
42 #ifndef __vtkClipClosedSurface_h
43 #define __vtkClipClosedSurface_h
44 
45 #include "vtkFiltersGeneralModule.h" // For export macro
46 #include "vtkPolyDataAlgorithm.h"
47 
48 class vtkPlaneCollection;
50 class vtkDoubleArray;
51 class vtkIdTypeArray;
52 class vtkCellArray;
53 class vtkPointData;
54 class vtkCellData;
55 class vtkPolygon;
56 class vtkIdList;
57 class vtkCCSEdgeLocator;
58 
59 enum {
63 };
64 
65 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
66 {
67 public:
68  static vtkClipClosedSurface *New();
70  void PrintSelf(ostream& os, vtkIndent indent);
71 
73 
74  virtual void SetClippingPlanes(vtkPlaneCollection *planes);
75  vtkGetObjectMacro(ClippingPlanes,vtkPlaneCollection);
77 
79 
82  vtkSetMacro(Tolerance, double);
83  vtkGetMacro(Tolerance, double);
85 
87 
89  vtkSetMacro(PassPointData, int);
90  vtkBooleanMacro(PassPointData, int);
91  vtkGetMacro(PassPointData, int);
93 
95 
97  vtkSetMacro(GenerateOutline, int);
98  vtkBooleanMacro(GenerateOutline, int);
99  vtkGetMacro(GenerateOutline, int);
101 
103 
105  vtkSetMacro(GenerateFaces, int);
106  vtkBooleanMacro(GenerateFaces, int);
107  vtkGetMacro(GenerateFaces, int);
109 
111 
117  vtkSetClampMacro(ScalarMode, int,
120  this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); };
122  this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); };
124  this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); };
125  vtkGetMacro(ScalarMode, int);
126  const char *GetScalarModeAsString();
128 
130 
134  vtkSetVector3Macro(BaseColor, double);
135  vtkGetVector3Macro(BaseColor, double);
137 
139 
142  vtkSetVector3Macro(ClipColor, double);
143  vtkGetVector3Macro(ClipColor, double);
145 
147 
150  vtkSetMacro(ActivePlaneId, int);
151  vtkGetMacro(ActivePlaneId, int);
153 
155 
158  vtkSetVector3Macro(ActivePlaneColor, double);
159  vtkGetVector3Macro(ActivePlaneColor, double);
161 
163 
167  vtkSetMacro(TriangulationErrorDisplay, int);
168  vtkBooleanMacro(TriangulationErrorDisplay, int);
169  vtkGetMacro(TriangulationErrorDisplay, int);
171 
172 protected:
175 
177 
178  double Tolerance;
179 
185  double BaseColor[3];
186  double ClipColor[3];
187  double ActivePlaneColor[3];
188 
190 
194 
195  virtual int ComputePipelineMTime(
196  vtkInformation* request, vtkInformationVector** inputVector,
197  vtkInformationVector* outputVector, int requestFromOutputPort,
198  unsigned long* mtime);
199 
200  virtual int RequestData(
201  vtkInformation* request, vtkInformationVector** inputVector,
202  vtkInformationVector* outputVector);
203 
205 
206  void ClipLines(
207  vtkPoints *points, vtkDoubleArray *pointScalars,
208  vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator,
209  vtkCellArray *inputCells, vtkCellArray *outputLines,
210  vtkCellData *inCellData, vtkCellData *outLineData);
212 
214 
218  void ClipAndContourPolys(
219  vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData,
220  vtkCCSEdgeLocator *edgeLocator, int triangulate,
221  vtkCellArray *inputCells, vtkCellArray *outputPolys,
222  vtkCellArray *outputLines, vtkCellData *inPolyData,
223  vtkCellData *outPolyData, vtkCellData *outLineData);
225 
227 
231  static int InterpolateEdge(
232  vtkPoints *points, vtkPointData *pointData,
233  vtkCCSEdgeLocator *edgeLocator, double tol,
234  vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i);
236 
238 
241  int TriangulatePolygon(
242  vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles);
244 
246 
253  void MakePolysFromContours(
254  vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines,
255  vtkCellArray *outputPolys, const double normal[3]);
257 
259 
263  static void BreakPolylines(
264  vtkCellArray *inputLines, vtkCellArray *outputLines,
265  vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar,
266  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
268 
270 
273  static void CopyPolygons(
274  vtkCellArray *inputPolys, vtkCellArray *outputPolys,
275  vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar,
276  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
278 
280 
282  static void BreakTriangleStrips(
283  vtkCellArray *inputStrips, vtkCellArray *outputPolys,
284  vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar,
285  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
287 
289 
292  static void SqueezeOutputPoints(
293  vtkPolyData *output, vtkPoints *points, vtkPointData *pointData,
294  int outputPointDataType);
296 
298 
299  static void CreateColorValues(
300  const double color1[3], const double color2[3], const double color3[3],
301  unsigned char colors[3][3]);
303 
304 private:
305  vtkClipClosedSurface(const vtkClipClosedSurface&); // Not implemented.
306  void operator=(const vtkClipClosedSurface&); // Not implemented.
307 };
308 
309 #endif