VTK  9.3.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
51 #ifndef vtkClipClosedSurface_h
52 #define vtkClipClosedSurface_h
53 
54 #include "vtkFiltersGeneralModule.h" // For export macro
55 #include "vtkPolyDataAlgorithm.h"
56 
57 VTK_ABI_NAMESPACE_BEGIN
58 class vtkPlaneCollection;
60 class vtkDoubleArray;
61 class vtkIdTypeArray;
62 class vtkCellArray;
63 class vtkPointData;
64 class vtkCellData;
65 class vtkPolygon;
66 class vtkIdList;
67 class vtkCCSEdgeLocator;
68 
69 enum
70 {
74 };
75 
76 class VTKFILTERSGENERAL_EXPORT vtkClipClosedSurface : public vtkPolyDataAlgorithm
77 {
78 public:
80 
83  static vtkClipClosedSurface* New();
85  void PrintSelf(ostream& os, vtkIndent indent) override;
87 
89 
92  virtual void SetClippingPlanes(vtkPlaneCollection* planes);
93  vtkGetObjectMacro(ClippingPlanes, vtkPlaneCollection);
95 
97 
102  vtkSetMacro(Tolerance, double);
103  vtkGetMacro(Tolerance, double);
105 
107 
111  vtkSetMacro(PassPointData, vtkTypeBool);
112  vtkBooleanMacro(PassPointData, vtkTypeBool);
113  vtkGetMacro(PassPointData, vtkTypeBool);
115 
117 
121  vtkSetMacro(GenerateOutline, vtkTypeBool);
122  vtkBooleanMacro(GenerateOutline, vtkTypeBool);
123  vtkGetMacro(GenerateOutline, vtkTypeBool);
125 
127 
131  vtkSetMacro(GenerateFaces, vtkTypeBool);
132  vtkBooleanMacro(GenerateFaces, vtkTypeBool);
133  vtkGetMacro(GenerateFaces, vtkTypeBool);
135 
137 
146  vtkSetClampMacro(ScalarMode, int, VTK_CCS_SCALAR_MODE_NONE, VTK_CCS_SCALAR_MODE_LABELS);
147  void SetScalarModeToNone() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_NONE); }
148  void SetScalarModeToColors() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_COLORS); }
149  void SetScalarModeToLabels() { this->SetScalarMode(VTK_CCS_SCALAR_MODE_LABELS); }
150  vtkGetMacro(ScalarMode, int);
151  const char* GetScalarModeAsString();
153 
155 
161  vtkSetVector3Macro(BaseColor, double);
162  vtkGetVector3Macro(BaseColor, double);
164 
166 
171  vtkSetVector3Macro(ClipColor, double);
172  vtkGetVector3Macro(ClipColor, double);
174 
176 
181  vtkSetMacro(ActivePlaneId, int);
182  vtkGetMacro(ActivePlaneId, int);
184 
186 
191  vtkSetVector3Macro(ActivePlaneColor, double);
192  vtkGetVector3Macro(ActivePlaneColor, double);
194 
196 
202  vtkSetMacro(TriangulationErrorDisplay, vtkTypeBool);
203  vtkBooleanMacro(TriangulationErrorDisplay, vtkTypeBool);
204  vtkGetMacro(TriangulationErrorDisplay, vtkTypeBool);
206 
208 
217  vtkSetMacro(InsideOut, vtkTypeBool);
218  vtkGetMacro(InsideOut, vtkTypeBool);
219  vtkBooleanMacro(InsideOut, vtkTypeBool);
221 
223 
228  vtkSetMacro(GenerateClipFaceOutput, vtkTypeBool);
229  vtkGetMacro(GenerateClipFaceOutput, vtkTypeBool);
230  vtkBooleanMacro(GenerateClipFaceOutput, vtkTypeBool);
232 
236  vtkPolyData* GetClipFaceOutput();
237 
238 protected:
240  ~vtkClipClosedSurface() override;
241 
243 
244  double Tolerance;
245 
251  double BaseColor[3];
252  double ClipColor[3];
253  double ActivePlaneColor[3];
254  vtkTypeBool InsideOut = false;
255  vtkTypeBool GenerateClipFaceOutput = false;
256 
258 
260 
261  int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inputVector,
262  vtkInformationVector* outputVector, int requestFromOutputPort, vtkMTimeType* mtime) override;
263 
264  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
265  vtkInformationVector* outputVector) override;
266 
270  void ClipLines(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
271  vtkCCSEdgeLocator* edgeLocator, vtkCellArray* inputCells, vtkCellArray* outputLines,
272  vtkCellData* inCellData, vtkCellData* outLineData);
273 
280  void ClipAndContourPolys(vtkPoints* points, vtkDoubleArray* pointScalars, vtkPointData* pointData,
281  vtkCCSEdgeLocator* edgeLocator, int triangulate, vtkCellArray* inputCells,
282  vtkCellArray* outputPolys, vtkCellArray* outputLines, vtkCellData* inCellData,
283  vtkCellData* outPolyData, vtkCellData* outLineData);
284 
291  static int InterpolateEdge(vtkPoints* points, vtkPointData* pointData,
292  vtkCCSEdgeLocator* edgeLocator, double tol, vtkIdType i0, vtkIdType i1, double v0, double v1,
293  vtkIdType& i);
294 
300  int TriangulatePolygon(vtkIdList* polygon, vtkPoints* points, vtkCellArray* triangles);
301 
311  void TriangulateContours(vtkPolyData* data, vtkIdType firstLine, vtkIdType numLines,
312  vtkCellArray* outputPolys, const double normal[3]);
313 
320  static void BreakPolylines(vtkCellArray* inputLines, vtkCellArray* outputLines,
321  vtkUnsignedCharArray* inputScalars, vtkIdType firstLineScalar,
322  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
323 
329  static void CopyPolygons(vtkCellArray* inputPolys, vtkCellArray* outputPolys,
330  vtkUnsignedCharArray* inputScalars, vtkIdType firstPolyScalar,
331  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
332 
337  static void BreakTriangleStrips(vtkCellArray* inputStrips, vtkCellArray* outputPolys,
338  vtkUnsignedCharArray* inputScalars, vtkIdType firstStripScalar,
339  vtkUnsignedCharArray* outputScalars, const unsigned char color[3]);
340 
346  static void SqueezeOutputPoints(
347  vtkPolyData* output, vtkPoints* points, vtkPointData* pointData, int outputPointDataType);
348 
352  static void CreateColorValues(const double color1[3], const double color2[3],
353  const double color3[3], unsigned char colors[3][3]);
354 
355 private:
357  void operator=(const vtkClipClosedSurface&) = delete;
358 };
359 
360 VTK_ABI_NAMESPACE_END
361 #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:29
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
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:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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:22
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:31
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:175
Store zero or more vtkInformation instances.
vtkPlaneCollection * ClippingPlanes
represent and manipulate 3D points
Definition: vtkPoints.h:28
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.