VTK  9.2.6
vtkHull.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHull.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
44 #ifndef vtkHull_h
45 #define vtkHull_h
46 
47 #include "vtkFiltersCoreModule.h" // For export macro
48 #include "vtkPointSetAlgorithm.h"
49 #include <vector> //for storing planes
50 
51 class vtkCellArray;
52 class vtkPlanes;
53 class vtkPoints;
54 class vtkPolyData;
55 
56 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPointSetAlgorithm
57 {
58 public:
60 
64  static vtkHull* New();
65  vtkTypeMacro(vtkHull, vtkPointSetAlgorithm);
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
72  void RemoveAllPlanes(void);
73 
75 
86  int AddPlane(double A, double B, double C);
87  int AddPlane(double plane[3]);
89 
91 
99  void SetPlane(int i, double A, double B, double C);
100  void SetPlane(int i, double plane[3]);
102 
104 
108  int AddPlane(double A, double B, double C, double D);
109  int AddPlane(double plane[3], double D);
110  void SetPlane(int i, double A, double B, double C, double D);
111  void SetPlane(int i, double plane[3], double D);
113 
118  void SetPlanes(vtkPlanes* planes);
119 
123  int GetNumberOfPlanes();
124 
130  void AddCubeVertexPlanes();
131 
138  void AddCubeEdgePlanes();
139 
144  void AddCubeFacePlanes();
145 
155  void AddRecursiveSpherePlanes(int level);
156 
158 
169  void GenerateHull(vtkPolyData* pd, double* bounds);
170  void GenerateHull(
171  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
173 
174 protected:
175  vtkHull() = default;
176  ~vtkHull() override = default;
177 
178  // The planes - 4 doubles per plane for A, B, C, D.
179  std::vector<double> Planes;
180 
181  // Internal method used to find the position of each plane
182  void ComputePlaneDistances(vtkPointSet* input);
183 
184  // Internal method used to create the actual polygons from the set
185  // of planes
186  void ClipPolygonsFromPlanes(vtkPoints* points, vtkCellArray* polys, const double* bounds);
187 
188  // Internal method used to create the initial "big" polygon from the
189  // plane equation. This polygon is clipped by all other planes to form
190  // the final polygon (or it may be clipped entirely)
191  void CreateInitialPolygon(double*, int, const double*);
192 
193  // The method that does it all...
195 
196  // Specify that the output is of type vtkPolyData
198 
199 private:
200  vtkHull(const vtkHull&) = delete;
201  void operator=(const vtkHull&) = delete;
202 };
203 
204 #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:52
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:69
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
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:56
a simple class to control print indentation
Definition: vtkIndent.h:39
Superclass for algorithms that produce output of the same type as input.
object to represent cell connectivity
Definition: vtkCellArray.h:186
static vtkPointSetAlgorithm * New()
std::vector< double > Planes
Definition: vtkHull.h:179
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:39