VTK  9.1.0
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=========================================================================*/
58#ifndef vtkClipClosedSurface_h
59#define vtkClipClosedSurface_h
60
61#include "vtkFiltersGeneralModule.h" // For export macro
63
66class vtkDoubleArray;
67class vtkIdTypeArray;
68class vtkCellArray;
69class vtkPointData;
70class vtkCellData;
71class vtkPolygon;
72class vtkIdList;
73class vtkCCSEdgeLocator;
74
75enum
76{
80};
81
82class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
94 vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
96
98
103 vtkSetMacro(Tolerance, double);
104 vtkGetMacro(Tolerance, double);
106
108
112 vtkSetMacro(PassPointData, vtkTypeBool);
113 vtkBooleanMacro(PassPointData, vtkTypeBool);
114 vtkGetMacro(PassPointData, vtkTypeBool);
116
118
122 vtkSetMacro(GenerateOutline, vtkTypeBool);
123 vtkBooleanMacro(GenerateOutline, vtkTypeBool);
124 vtkGetMacro(GenerateOutline, vtkTypeBool);
126
128
132 vtkSetMacro(GenerateFaces, vtkTypeBool);
133 vtkBooleanMacro(GenerateFaces, vtkTypeBool);
134 vtkGetMacro(GenerateFaces, vtkTypeBool);
136
138
147 vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
148 void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
149 void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
150 void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
151 vtkGetMacro(ScalarMode, int);
154
156
162 vtkSetVector3Macro(BaseColor, double);
163 vtkGetVector3Macro(BaseColor, double);
165
167
172 vtkSetVector3Macro(ClipColor, double);
173 vtkGetVector3Macro(ClipColor, double);
175
177
182 vtkSetMacro(ActivePlaneId, int);
183 vtkGetMacro(ActivePlaneId, int);
185
187
192 vtkSetVector3Macro(ActivePlaneColor, double);
193 vtkGetVector3Macro(ActivePlaneColor, double);
195
197
203 vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
204 vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
205 vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
207
208protected:
211
213
214 double Tolerance;
215
221 double BaseColor[3];
222 double ClipColor[3];
223 double ActivePlaneColor[3];
224
226
228
230 vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
231
233 vtkInformationVector* outputVector) override;
234
238 void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
239 vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
240 vtkCellData* inCellData, vtkCellData* outLineData);
241
249 vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
250 vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inCellData,
251 vtkCellData* outPolyData, vtkCellData* outLineData);
252
260 vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
261 vtkIdType& i);
262
269
280 vtkCellArray* outputPolys, const double normal[3]);
281
288 static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
289 vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
290 vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
291
297 static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
298 vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
299 vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
300
305 static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
306 vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
307 vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
308
315 vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
316
320 static void CreateColorValues(const double color1[3], const double color2[3],
321 const double color3[3], unsigned char colors[3][3]);
322
323private:
325 void operator=(const vtkClipClosedSurface&) = delete;
326};
327
328#endif
object to represent cell connectivity
Definition: vtkCellArray.h:190
represent and manipulate cell attribute data
Definition: vtkCellData.h:42
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.
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
Methods invoked by print to print information about the object including superclasses.
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...
virtual void SetClippingPlanes(vtkPlaneCollection *planes)
Set the vtkPlaneCollection that holds the clipping planes.
const char * GetScalarModeAsString()
Set whether to add cell scalars, so that new faces and outlines can be distinguished from original fa...
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 vtkClipClosedSurface * New()
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:40
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
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:42
represent and manipulate 3D points
Definition: vtkPoints.h:43
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:49
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