VTK  9.2.6
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 =========================================================================*/
74 #ifndef vtkClipClosedSurface_h
75 #define vtkClipClosedSurface_h
76 
77 #include "vtkFiltersGeneralModule.h" // For export macro
78 #include "vtkPolyDataAlgorithm.h"
79 
80 class vtkPlaneCollection;
82 class vtkDoubleArray;
83 class vtkIdTypeArray;
84 class vtkCellArray;
85 class vtkPointData;
86 class vtkCellData;
87 class vtkPolygon;
88 class vtkIdList;
89 class vtkCCSEdgeLocator;
90 
91 enum
92 {
96 };
97 
98 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
99 {
100 public:
102 
107  void PrintSelf(ostream& os, vtkIndent indent) override;
109 
111 
114  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
115  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
117 
119 
124  vtkSetMacro(Tolerance, double);
125  vtkGetMacro(Tolerance, double);
127 
129 
133  vtkSetMacro(PassPointData, vtkTypeBool);
134  vtkBooleanMacro(PassPointData, vtkTypeBool);
135  vtkGetMacro(PassPointData, vtkTypeBool);
137 
139 
143  vtkSetMacro(GenerateOutline, vtkTypeBool);
144  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
145  vtkGetMacro(GenerateOutline, vtkTypeBool);
147 
149 
153  vtkSetMacro(GenerateFaces, vtkTypeBool);
154  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
155  vtkGetMacro(GenerateFaces, vtkTypeBool);
157 
159 
168  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
169  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
170  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
171  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
172  vtkGetMacro(ScalarMode, int);
173  const char* GetScalarModeAsString();
175 
177 
183  vtkSetVector3Macro(BaseColor, double);
184  vtkGetVector3Macro(BaseColor, double);
186 
188 
193  vtkSetVector3Macro(ClipColor, double);
194  vtkGetVector3Macro(ClipColor, double);
196 
198 
203  vtkSetMacro(ActivePlaneId, int);
204  vtkGetMacro(ActivePlaneId, int);
206 
208 
213  vtkSetVector3Macro(ActivePlaneColor, double);
214  vtkGetVector3Macro(ActivePlaneColor, double);
216 
218 
224  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
225  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
226  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
228 
229 protected:
232 
234 
235  double Tolerance;
236 
242  double BaseColor[3];
243  double ClipColor[3];
244  double ActivePlaneColor[3];
245 
247 
249 
251  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
252 
253  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
254  vtkInformationVector* outputVector) override;
255 
259  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
260  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
261  vtkCellData* inCellData, vtkCellData* outLineData);
262 
270  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
271  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inCellData,
272  vtkCellData* outPolyData, vtkCellData* outLineData);
273 
280  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
281  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
282  vtkIdType& i);
283 
290 
301  vtkCellArray* outputPolys, const double normal[3]);
302 
309  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
310  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
311  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
312 
318  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
319  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
320  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
321 
326  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
327  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
328  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
329 
335  static void SqueezeOutputPoints(
336  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
337 
341  static void CreateColorValues(const double color1[3], const double color2[3],
342  const double color3[3], unsigned char colors[3][3]);
343 
344 private:
346  void operator=(const vtkClipClosedSurface&) = delete;
347 };
348 
349 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
represent and manipulate cell attribute data
Definition: vtkCellData.h:151
Clip a closed surface with a plane collection.
static void BreakTriangleStrips(vtkCellArray *inputStrips, vtkCellArray *outputPolys, vtkUnsignedCharArray *inputScalars, vtkIdType firstStripScalar, vtkUnsignedCharArray *outputScalars, const unsigned char color[3])
Break triangle strips and add the triangles to the output.
const char * GetScalarModeAsString()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
static void CopyPolygons(vtkCellArray *inputPolys, vtkCellArray *outputPolys, vtkUnsignedCharArray *inputScalars, vtkIdType firstPolyScalar, vtkUnsignedCharArray *outputScalars, const unsigned char color[3])
Copy polygons and their associated scalars to a new array.
void ClipLines(vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator, vtkCellArray *inputCells, vtkCellArray *outputLines, vtkCellData *inCellData, vtkCellData *outLineData)
Method for clipping lines and copying the scalar data.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
static void SqueezeOutputPoints(vtkPolyData *output, vtkPoints *points, vtkPointData *pointData, int outputPointDataType)
Squeeze the points and store them in the output.
vtkPlaneCollection * ClippingPlanes
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing.
void SetScalarModeToLabels()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
void SetScalarModeToColors()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
static vtkClipClosedSurface * New()
Standard methods for instantiation, obtaining type information, and printing.
virtual void SetClippingPlanes(vtkPlaneCollection *planes)
Set the vtkPlaneCollection that holds the clipping planes.
void TriangulateContours(vtkPolyData *data, vtkIdType firstLine, vtkIdType numLines, vtkCellArray *outputPolys, const double normal[3])
Given some closed contour lines, create a triangle mesh that fills those lines.
static void CreateColorValues(const double color1[3], const double color2[3], const double color3[3], unsigned char colors[3][3])
Take three colors as doubles, and convert to unsigned char.
void SetScalarModeToNone()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
int TriangulatePolygon(vtkIdList *polygon, vtkPoints *points, vtkCellArray *triangles)
A robust method for triangulating a polygon.
int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, int requestFromOutputPort, vtkMTimeType *mtime) override
A special version of ProcessRequest meant specifically for the pipeline modified time request.
~vtkClipClosedSurface() override
static int InterpolateEdge(vtkPoints *points, vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1, vtkIdType &i)
A helper function for interpolating a new point along an edge.
static void BreakPolylines(vtkCellArray *inputLines, vtkCellArray *outputLines, vtkUnsignedCharArray *inputScalars, vtkIdType firstLineScalar, vtkUnsignedCharArray *outputScalars, const unsigned char color[3])
Break polylines into individual lines, copying scalar values from inputScalars starting at firstLineS...
void ClipAndContourPolys(vtkPoints *points, vtkDoubleArray *pointScalars, vtkPointData *pointData, vtkCCSEdgeLocator *edgeLocator, int triangulate, vtkCellArray *inputCells, vtkCellArray *outputPolys, vtkCellArray *outputLines, vtkCellData *inCellData, vtkCellData *outPolyData, vtkCellData *outLineData)
Clip and contour polys in one step, in order to guarantee that the contour lines exactly match the ne...
vtkTypeBool TriangulationErrorDisplay
dynamic, self-adjusting array of double
list of point or cell ids
Definition: vtkIdList.h:143
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
maintain a list of planes
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:152
dynamic, self-adjusting array of unsigned char
@ points
Definition: vtkX3D.h:452
@ color
Definition: vtkX3D.h:227
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
@ VTK_CCS_SCALAR_MODE_NONE
@ VTK_CCS_SCALAR_MODE_LABELS
@ VTK_CCS_SCALAR_MODE_COLORS
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287