VTK  9.7.1
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 
92  static vtkClipClosedSurface* New();
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 
245  vtkPolyData* GetClipFaceOutput();
246 
247 protected:
249  ~vtkClipClosedSurface() override;
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 
270  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inputVector,
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 
289  void ClipAndContourPolys(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
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 
309  int TriangulatePolygon(vtkIdList* polygon, vtkPoints* points, vtkCellArray* triangles);
310 
320  void TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines,
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
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:30
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
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:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
const std::string pointData
vtkTypeBool TriangulationErrorDisplay
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
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:25
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:177
Store zero or more vtkInformation instances.
vtkPlaneCollection * ClippingPlanes
represent and manipulate 3D points
Definition: vtkPoints.h:30
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.