VTK  9.7.1
vtkHull.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
32 #ifndef vtkHull_h
33 #define vtkHull_h
34 
35 #include "vtkFiltersCoreModule.h" // For export macro
36 #include "vtkPointSetAlgorithm.h"
37 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
38 #include <vector> //for storing planes
39 
40 VTK_ABI_NAMESPACE_BEGIN
41 class vtkCellArray;
42 class vtkPlanes;
43 class vtkPoints;
44 class vtkPolyData;
45 
46 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkHull : public vtkPointSetAlgorithm
47 {
48 public:
50 
54  static vtkHull* New();
55  vtkTypeMacro(vtkHull, vtkPointSetAlgorithm);
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  void RemoveAllPlanes();
63 
65 
76  int AddPlane(double A, double B, double C);
77  int AddPlane(double plane[3]);
79 
81 
89  void SetPlane(int i, double A, double B, double C);
90  void SetPlane(int i, double plane[3]);
92 
94 
98  int AddPlane(double A, double B, double C, double D);
99  int AddPlane(double plane[3], double D);
100  void SetPlane(int i, double A, double B, double C, double D);
101  void SetPlane(int i, double plane[3], double D);
103 
108  void SetPlanes(vtkPlanes* planes);
109 
113  int GetNumberOfPlanes();
114 
120  void AddCubeVertexPlanes();
121 
128  void AddCubeEdgePlanes();
129 
134  void AddCubeFacePlanes();
135 
145  void AddRecursiveSpherePlanes(int level);
146 
148 
159  void GenerateHull(vtkPolyData* pd, double* bounds);
160  void GenerateHull(
161  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
163 
164 protected:
165  vtkHull() = default;
166  ~vtkHull() override = default;
167 
168  // The planes - 4 doubles per plane for A, B, C, D.
169  std::vector<double> Planes;
170 
171  // Internal method used to find the position of each plane
172  void ComputePlaneDistances(vtkPointSet* input);
173 
174  // Internal method used to create the actual polygons from the set
175  // of planes
176  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
177 
178  // Internal method used to create the initial "big" polygon from the
179  // plane equation. This polygon is clipped by all other planes to form
180  // the final polygon (or it may be clipped entirely)
181  void CreateInitialPolygon(double*, int, const double*);
182 
183  // The method that does it all...
185 
186  // Specify that the output is of type vtkPolyData
188 
189 private:
190  vtkHull(const vtkHull&) = delete;
191  void operator=(const vtkHull&) = delete;
192 };
193 
194 VTK_ABI_NAMESPACE_END
195 #endif
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Store vtkAlgorithm input/output information.
implicit function for convex set of planes
Definition: vtkPlanes.h:41
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing instances of the class...
concrete class for storing a set of points
Definition: vtkPointSet.h:58
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
produce an n-sided convex hull
Definition: vtkHull.h:46
a simple class to control print indentation
Definition: vtkIndent.h:28
Superclass for algorithms that process vtkPointSet input.
object to represent cell connectivity
Definition: vtkCellArray.h:177
static vtkPointSetAlgorithm * New()
Standard methods for instantiation, obtaining type information, and printing instances of the class...
std::vector< double > Planes
Definition: vtkHull.h:169
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
represent and manipulate 3D points
Definition: vtkPoints.h:30