VTK  9.0.1
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
67 {
71 };
72 
73 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
74 {
75 public:
76  static vtkClipClosedSurface* New();
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
84  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
85  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
87 
89 
94  vtkSetMacro(Tolerance, double);
95  vtkGetMacro(Tolerance, double);
97 
99 
103  vtkSetMacro(PassPointData, vtkTypeBool);
104  vtkBooleanMacro(PassPointData, vtkTypeBool);
105  vtkGetMacro(PassPointData, vtkTypeBool);
107 
109 
113  vtkSetMacro(GenerateOutline, vtkTypeBool);
114  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
115  vtkGetMacro(GenerateOutline, vtkTypeBool);
117 
119 
123  vtkSetMacro(GenerateFaces, vtkTypeBool);
124  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
125  vtkGetMacro(GenerateFaces, vtkTypeBool);
127 
129 
138  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
139  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
140  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
141  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
142  vtkGetMacro(ScalarMode, int);
143  const char* GetScalarModeAsString();
145 
147 
153  vtkSetVector3Macro(BaseColor, double);
154  vtkGetVector3Macro(BaseColor, double);
156 
158 
163  vtkSetVector3Macro(ClipColor, double);
164  vtkGetVector3Macro(ClipColor, double);
166 
168 
173  vtkSetMacro(ActivePlaneId, int);
174  vtkGetMacro(ActivePlaneId, int);
176 
178 
183  vtkSetVector3Macro(ActivePlaneColor, double);
184  vtkGetVector3Macro(ActivePlaneColor, double);
186 
188 
194  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
195  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
196  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
198 
199 protected:
201  ~vtkClipClosedSurface() override;
202 
204 
205  double Tolerance;
206 
212  double BaseColor[3];
213  double ClipColor[3];
214  double ActivePlaneColor[3];
215 
217 
219 
220  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inputVector,
221  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
222 
223  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
224  vtkInformationVector* outputVector) override;
225 
229  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
230  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
231  vtkCellData* inCellData, vtkCellData* outLineData);
232 
239  void ClipAndContourPolys(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
240  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
241  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inPolyData,
242  vtkCellData* outPolyData, vtkCellData* outLineData);
243 
250  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
251  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
252  vtkIdType& i);
253 
259  int TriangulatePolygon(vtkIdList* polygon, vtkPoints* points, vtkCellArray* triangles);
260 
270  void TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines,
271  vtkCellArray* outputPolys, const double normal[3]);
272 
279  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
280  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
281  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
282 
288  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
289  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
290  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
291 
296  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
297  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
298  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
299 
305  static void SqueezeOutputPoints(
306  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
307 
311  static void CreateColorValues(const double color1[3], const double color2[3],
312  const double color3[3], unsigned char colors[3][3]);
313 
314 private:
316  void operator=(const vtkClipClosedSurface&) = delete;
317 };
318 
319 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
VTK_CCS_SCALAR_MODE_COLORS
@ VTK_CCS_SCALAR_MODE_COLORS
Definition: vtkClipClosedSurface.h:69
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkClipClosedSurface::ActivePlaneId
int ActivePlaneId
Definition: vtkClipClosedSurface.h:210
VTK_CCS_SCALAR_MODE_NONE
@ VTK_CCS_SCALAR_MODE_NONE
Definition: vtkClipClosedSurface.h:68
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkClipClosedSurface::SetScalarModeToNone
void SetScalarModeToNone()
Definition: vtkClipClosedSurface.h:139
vtkClipClosedSurface::GenerateFaces
vtkTypeBool GenerateFaces
Definition: vtkClipClosedSurface.h:209
vtkClipClosedSurface::ScalarMode
int ScalarMode
Definition: vtkClipClosedSurface.h:211
vtkPolyDataAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkClipClosedSurface::SetScalarModeToColors
void SetScalarModeToColors()
Definition: vtkClipClosedSurface.h:140
vtkClipClosedSurface::SetScalarModeToLabels
void SetScalarModeToLabels()
Definition: vtkClipClosedSurface.h:141
vtkClipClosedSurface::TriangulationErrorDisplay
vtkTypeBool TriangulationErrorDisplay
Definition: vtkClipClosedSurface.h:216
vtkPolyDataAlgorithm.h
VTK_CCS_SCALAR_MODE_LABELS
@ VTK_CCS_SCALAR_MODE_LABELS
Definition: vtkClipClosedSurface.h:70
vtkX3D::color
@ color
Definition: vtkX3D.h:227
vtkX3D::points
@ points
Definition: vtkX3D.h:452
vtkClipClosedSurface::IdList
vtkIdList * IdList
Definition: vtkClipClosedSurface.h:218
vtkClipClosedSurface
Clip a closed surface with a plane collection.
Definition: vtkClipClosedSurface.h:73
vtkPolyDataAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:179
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkClipClosedSurface::ClippingPlanes
vtkPlaneCollection * ClippingPlanes
Definition: vtkClipClosedSurface.h:203
vtkClipClosedSurface::GenerateOutline
vtkTypeBool GenerateOutline
Definition: vtkClipClosedSurface.h:208
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkClipClosedSurface::PassPointData
vtkTypeBool PassPointData
Definition: vtkClipClosedSurface.h:207
vtkClipClosedSurface::Tolerance
double Tolerance
Definition: vtkClipClosedSurface.h:205
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkAlgorithm::ComputePipelineMTime
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.
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:33
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPolyDataAlgorithm::New
static vtkPolyDataAlgorithm * New()
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:41