VTK  9.3.0
vtkClipClosedSurface.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
60 #ifndef vtkClipClosedSurface_h
61 #define vtkClipClosedSurface_h
62 
63 #include "vtkFiltersGeneralModule.h" // For export macro
64 #include "vtkPolyDataAlgorithm.h"
65 
66 VTK_ABI_NAMESPACE_BEGIN
67 class vtkPlaneCollection;
69 class vtkDoubleArray;
70 class vtkIdTypeArray;
71 class vtkCellArray;
72 class vtkPointData;
73 class vtkCellData;
74 class vtkPolygon;
75 class vtkIdList;
76 class vtkCCSEdgeLocator;
77 
78 enum
79 {
83 };
84 
85 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
86 {
87 public:
89 
94  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
98 
101  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
102  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
104 
106 
111  vtkSetMacro(Tolerance, double);
112  vtkGetMacro(Tolerance, double);
114 
116 
120  vtkSetMacro(PassPointData, vtkTypeBool);
121  vtkBooleanMacro(PassPointData, vtkTypeBool);
122  vtkGetMacro(PassPointData, vtkTypeBool);
124 
126 
130  vtkSetMacro(GenerateOutline, vtkTypeBool);
131  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
132  vtkGetMacro(GenerateOutline, vtkTypeBool);
134 
136 
140  vtkSetMacro(GenerateFaces, vtkTypeBool);
141  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
142  vtkGetMacro(GenerateFaces, vtkTypeBool);
144 
146 
155  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
156  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
157  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
158  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
159  vtkGetMacro(ScalarMode, int);
160  const char* GetScalarModeAsString();
162 
164 
170  vtkSetVector3Macro(BaseColor, double);
171  vtkGetVector3Macro(BaseColor, double);
173 
175 
180  vtkSetVector3Macro(ClipColor, double);
181  vtkGetVector3Macro(ClipColor, double);
183 
185 
190  vtkSetMacro(ActivePlaneId, int);
191  vtkGetMacro(ActivePlaneId, int);
193 
195 
200  vtkSetVector3Macro(ActivePlaneColor, double);
201  vtkGetVector3Macro(ActivePlaneColor, double);
203 
205 
211  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
212  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
213  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
215 
217 
226  vtkSetMacro(InsideOut, vtkTypeBool);
227  vtkGetMacro(InsideOut, vtkTypeBool);
228  vtkBooleanMacro(InsideOut, vtkTypeBool);
230 
232 
237  vtkSetMacro(GenerateClipFaceOutput, vtkTypeBool);
238  vtkGetMacro(GenerateClipFaceOutput, vtkTypeBool);
239  vtkBooleanMacro(GenerateClipFaceOutput, vtkTypeBool);
241 
246 
247 protected:
250 
252 
253  double Tolerance;
254 
260  double BaseColor[3];
261  double ClipColor[3];
262  double ActivePlaneColor[3];
263  vtkTypeBool InsideOut = false;
264  vtkTypeBool GenerateClipFaceOutput = false;
265 
267 
269 
271  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
272 
273  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
274  vtkInformationVector* outputVector) override;
275 
279  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
280  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
281  vtkCellData* inCellData, vtkCellData* outLineData);
282 
290  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
291  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inCellData,
292  vtkCellData* outPolyData, vtkCellData* outLineData);
293 
300  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
301  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
302  vtkIdType& i);
303 
310 
321  vtkCellArray* outputPolys, const double normal[3]);
322 
329  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
330  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
331  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
332 
338  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
339  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
340  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
341 
346  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
347  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
348  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
349 
355  static void SqueezeOutputPoints(
356  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
357 
361  static void CreateColorValues(const double color1[3], const double color2[3],
362  const double color3[3], unsigned char colors[3][3]);
363 
364 private:
366  void operator=(const vtkClipClosedSurface&) = delete;
367 };
368 
369 VTK_ABI_NAMESPACE_END
370 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
represent and manipulate cell attribute data
Definition: vtkCellData.h:40
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
vtkPolyData * GetClipFaceOutput()
Return the clip face triangulated output.
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:32
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:38
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:39
represent and manipulate 3D points
Definition: vtkPoints.h:38
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:41
dynamic, self-adjusting array of unsigned char
@ points
Definition: vtkX3D.h:446
@ color
Definition: vtkX3D.h:221
@ data
Definition: vtkX3D.h:315
int vtkTypeBool
Definition: vtkABI.h:64
@ VTK_CCS_SCALAR_MODE_NONE
@ VTK_CCS_SCALAR_MODE_LABELS
@ VTK_CCS_SCALAR_MODE_COLORS
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270