VTK  9.3.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 <vector> //for storing planes
38 
39 VTK_ABI_NAMESPACE_BEGIN
40 class vtkCellArray;
41 class vtkPlanes;
42 class vtkPoints;
43 class vtkPolyData;
44 
45 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPointSetAlgorithm
46 {
47 public:
49 
53  static vtkHull* New();
54  vtkTypeMacro(vtkHull, vtkPointSetAlgorithm);
55  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  void RemoveAllPlanes();
62 
64 
75  int AddPlane(double A, double B, double C);
76  int AddPlane(double plane[3]);
78 
80 
88  void SetPlane(int i, double A, double B, double C);
89  void SetPlane(int i, double plane[3]);
91 
93 
97  int AddPlane(double A, double B, double C, double D);
98  int AddPlane(double plane[3], double D);
99  void SetPlane(int i, double A, double B, double C, double D);
100  void SetPlane(int i, double plane[3], double D);
102 
107  void SetPlanes(vtkPlanes* planes);
108 
112  int GetNumberOfPlanes();
113 
119  void AddCubeVertexPlanes();
120 
127  void AddCubeEdgePlanes();
128 
133  void AddCubeFacePlanes();
134 
144  void AddRecursiveSpherePlanes(int level);
145 
147 
158  void GenerateHull(vtkPolyData* pd, double* bounds);
159  void GenerateHull(
160  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
162 
163 protected:
164  vtkHull() = default;
165  ~vtkHull() override = default;
166 
167  // The planes - 4 doubles per plane for A, B, C, D.
168  std::vector<double> Planes;
169 
170  // Internal method used to find the position of each plane
171  void ComputePlaneDistances(vtkPointSet* input);
172 
173  // Internal method used to create the actual polygons from the set
174  // of planes
175  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
176 
177  // Internal method used to create the initial "big" polygon from the
178  // plane equation. This polygon is clipped by all other planes to form
179  // the final polygon (or it may be clipped entirely)
180  void CreateInitialPolygon(double*, int, const double*);
181 
182  // The method that does it all...
184 
185  // Specify that the output is of type vtkPolyData
187 
188 private:
189  vtkHull(const vtkHull&) = delete;
190  void operator=(const vtkHull&) = delete;
191 };
192 
193 VTK_ABI_NAMESPACE_END
194 #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
Methods invoked by print to print information about the object including superclasses.
concrete class for storing a set of points
Definition: vtkPointSet.h:58
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
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:45
a simple class to control print indentation
Definition: vtkIndent.h:28
Superclass for algorithms that produce output of the same type as input.
object to represent cell connectivity
Definition: vtkCellArray.h:175
static vtkPointSetAlgorithm * New()
std::vector< double > Planes
Definition: vtkHull.h:168
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:28