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 =========================================================================*/
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 {
70 };
71 
72 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
73 {
74 public:
75  static vtkClipClosedSurface *New();
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
80 
83  virtual void SetClippingPlanes(vtkPlaneCollection *planes);
84  vtkGetObjectMacro(ClippingPlanes,vtkPlaneCollection);
86 
88 
93  vtkSetMacro(Tolerance, double);
94  vtkGetMacro(Tolerance, double);
96 
98 
102  vtkSetMacro(PassPointData, vtkTypeBool);
103  vtkBooleanMacro(PassPointData, vtkTypeBool);
104  vtkGetMacro(PassPointData, vtkTypeBool);
106 
108 
112  vtkSetMacro(GenerateOutline, vtkTypeBool);
113  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
114  vtkGetMacro(GenerateOutline, vtkTypeBool);
116 
118 
122  vtkSetMacro(GenerateFaces, vtkTypeBool);
123  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
124  vtkGetMacro(GenerateFaces, vtkTypeBool);
126 
128 
137  vtkSetClampMacro(ScalarMode, int,
140  this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); };
142  this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); };
144  this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); };
145  vtkGetMacro(ScalarMode, int);
146  const char *GetScalarModeAsString();
148 
150 
156  vtkSetVector3Macro(BaseColor, double);
157  vtkGetVector3Macro(BaseColor, double);
159 
161 
166  vtkSetVector3Macro(ClipColor, double);
167  vtkGetVector3Macro(ClipColor, double);
169 
171 
176  vtkSetMacro(ActivePlaneId, int);
177  vtkGetMacro(ActivePlaneId, int);
179 
181 
186  vtkSetVector3Macro(ActivePlaneColor, double);
187  vtkGetVector3Macro(ActivePlaneColor, double);
189 
191 
197  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
198  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
199  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
201 
202 protected:
204  ~vtkClipClosedSurface() override;
205 
207 
208  double Tolerance;
209 
215  double BaseColor[3];
216  double ClipColor[3];
217  double ActivePlaneColor[3];
218 
220 
222 
224  vtkInformation* request, vtkInformationVector** inputVector,
225  vtkInformationVector* outputVector, int requestFromOutputPort,
226  vtkMTimeType* mtime) override;
227 
228  int RequestData(
229  vtkInformation* request, vtkInformationVector** inputVector,
230  vtkInformationVector* outputVector) override;
231 
235  void ClipLines(
236  vtkPoints *points, vtkDoubleArray *pointScalars,
237  vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator,
238  vtkCellArray *inputCells, vtkCellArray *outputLines,
239  vtkCellData *inCellData, vtkCellData *outLineData);
240 
247  void ClipAndContourPolys(
248  vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData,
249  vtkCCSEdgeLocator *edgeLocator, int triangulate,
250  vtkCellArray *inputCells, vtkCellArray *outputPolys,
251  vtkCellArray *outputLines, vtkCellData *inPolyData,
252  vtkCellData *outPolyData, vtkCellData *outLineData);
253 
260  static int InterpolateEdge(
261  vtkPoints *points, vtkPointData *pointData,
262  vtkCCSEdgeLocator *edgeLocator, double tol,
263  vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i);
264 
270  int TriangulatePolygon(
271  vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles);
272 
282  void TriangulateContours(
283  vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines,
284  vtkCellArray *outputPolys, const double normal[3]);
285 
292  static void BreakPolylines(
293  vtkCellArray *inputLines, vtkCellArray *outputLines,
294  vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar,
295  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
296 
302  static void CopyPolygons(
303  vtkCellArray *inputPolys, vtkCellArray *outputPolys,
304  vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar,
305  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
306 
311  static void BreakTriangleStrips(
312  vtkCellArray *inputStrips, vtkCellArray *outputPolys,
313  vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar,
314  vtkUnsignedCharArray *outputScalars, const unsigned char color[3]);
315 
321  static void SqueezeOutputPoints(
322  vtkPolyData *output, vtkPoints *points, vtkPointData *pointData,
323  int outputPointDataType);
324 
328  static void CreateColorValues(
329  const double color1[3], const double color2[3], const double color3[3],
330  unsigned char colors[3][3]);
331 
332 private:
334  void operator=(const vtkClipClosedSurface&) = delete;
335 };
336 
337 #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:300
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:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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:44
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.