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 "vtkPolyDataAlgorithm.h"
46 
47 class vtkPlaneCollection;
49 class vtkDoubleArray;
50 class vtkIdTypeArray;
51 class vtkCellArray;
52 class vtkPointData;
53 class vtkCellData;
54 class vtkPolygon;
55 class vtkIdList;
56 class vtkCCSEdgeLocator;
57 
58 enum {
62 };
63 
65 {
66 public:
67  static vtkClipClosedSurface *New();
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
72 
73  virtual void SetClippingPlanes(vtkPlaneCollection *planes);
74  vtkGetObjectMacro(ClippingPlanes,vtkPlaneCollection);
76 
78 
81  vtkSetMacro(Tolerance, double);
82  vtkGetMacro(Tolerance, double);
84 
86 
88  vtkSetMacro(PassPointData, int);
89  vtkBooleanMacro(PassPointData, int);
90  vtkGetMacro(PassPointData, int);
92 
94 
96  vtkSetMacro(GenerateOutline, int);
97  vtkBooleanMacro(GenerateOutline, int);
98  vtkGetMacro(GenerateOutline, int);
100 
102 
104  vtkSetMacro(GenerateFaces, int);
105  vtkBooleanMacro(GenerateFaces, int);
106  vtkGetMacro(GenerateFaces, int);
108 
110 
116  vtkSetClampMacro(ScalarMode, int,
119  this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); };
121  this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); };
123  this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); };
124  vtkGetMacro(ScalarMode, int);
125  const char *GetScalarModeAsString();
127 
129 
133  vtkSetVector3Macro(BaseColor, double);
134  vtkGetVector3Macro(BaseColor, double);
136 
138 
141  vtkSetVector3Macro(ClipColor, double);
142  vtkGetVector3Macro(ClipColor, double);
144 
146 
149  vtkSetMacro(ActivePlaneId, int);
150  vtkGetMacro(ActivePlaneId, int);
152 
154 
157  vtkSetVector3Macro(ActivePlaneColor, double);
158  vtkGetVector3Macro(ActivePlaneColor, double);
160 
162 
166  vtkSetMacro(TriangulationErrorDisplay, int);
167  vtkBooleanMacro(TriangulationErrorDisplay, int);
168  vtkGetMacro(TriangulationErrorDisplay, int);
170 
171  // Legacy methods, do not use.
172  VTK_LEGACY(void SetGenerateColorScalars(int));
173  VTK_LEGACY(int GetGenerateColorScalars());
174  VTK_LEGACY(void GenerateColorScalarsOn());
175  VTK_LEGACY(void GenerateColorScalarsOff());
176 
177 protected:
180 
182 
183  double Tolerance;
184 
190  double BaseColor[3];
191  double ClipColor[3];
192  double ActivePlaneColor[3];
193 
195 
199 
200  virtual int ComputePipelineMTime(
201  vtkInformation* request, vtkInformationVector** inputVector,
202  vtkInformationVector* outputVector, int requestFromOutputPort,
203  unsigned long* mtime);
204 
205  virtual int RequestData(
206  vtkInformation* request, vtkInformationVector** inputVector,
207  vtkInformationVector* outputVector);
208 
210 
211  void ClipLines(
212  vtkPoints *points, vtkDoubleArray *pointScalars,
213  vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator,
214  vtkCellArray *inputCells, vtkCellArray *outputLines,
215  vtkCellData *inCellData, vtkCellData *outLineData);
217 
219 
223  void ClipAndContourPolys(
224  vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData,
225  vtkCCSEdgeLocator *edgeLocator, int triangulate,
226  vtkCellArray *inputCells, vtkCellArray *outputPolys,
227  vtkCellArray *outputLines, vtkCellData *inPolyData,
228  vtkCellData *outPolyData, vtkCellData *outLineData);
230 
232 
236  static int InterpolateEdge(
237  vtkPoints *points, vtkPointData *pointData,
238  vtkCCSEdgeLocator *edgeLocator, double tol,
239  vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i);
241 
243 
246  int TriangulatePolygon(
247  vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles);
249 
251 
258  void MakePolysFromContours(
259  vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines,
260  vtkCellArray *outputPolys, const double normal[3]);
262 
264 
268  static void BreakPolylines(
269  vtkCellArray *inputLines, vtkCellArray *outputLines,
270  vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar,
271  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
273 
275 
278  static void CopyPolygons(
279  vtkCellArray *inputPolys, vtkCellArray *outputPolys,
280  vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar,
281  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
283 
285 
287  static void BreakTriangleStrips(
288  vtkCellArray *inputStrips, vtkCellArray *outputPolys,
289  vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar,
290  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
292 
294 
297  static void SqueezeOutputPoints(
298  vtkPolyData *output, vtkPoints *points, vtkPointData *pointData,
299  int outputPointDataType);
301 
303 
304  static void CreateColorValues(
305  const double color1[3], const double color2[3], const double color3[3],
306  unsigned char colors[3][3]);
308 
309 private:
310  vtkClipClosedSurface(const vtkClipClosedSurface&); // Not implemented.
311  void operator=(const vtkClipClosedSurface&); // Not implemented.
312 };
313 
314 #endif