VTK  9.0.1
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 =========================================================================*/
41 #ifndef vtkHull_h
42 #define vtkHull_h
43 
44 #include "vtkFiltersCoreModule.h" // For export macro
45 #include "vtkPolyDataAlgorithm.h"
46 
47 class vtkCellArray;
48 class vtkPlanes;
49 class vtkPoints;
50 class vtkPolyData;
51 
52 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm
53 {
54 public:
55  static vtkHull* New();
56  vtkTypeMacro(vtkHull, vtkPolyDataAlgorithm);
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  void RemoveAllPlanes(void);
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 
111 
114  vtkGetMacro(NumberOfPlanes, int);
116 
122  void AddCubeVertexPlanes();
123 
130  void AddCubeEdgePlanes();
131 
136  void AddCubeFacePlanes();
137 
147  void AddRecursiveSpherePlanes(int level);
148 
150 
161  void GenerateHull(vtkPolyData* pd, double* bounds);
162  void GenerateHull(
163  vtkPolyData* pd, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
165 
166 protected:
167  vtkHull();
168  ~vtkHull() override;
169 
170  // The planes - 4 doubles per plane for A, B, C, D
171  double* Planes;
172 
173  // This indicates the current size (in planes - 4*sizeof(double)) of
174  // the this->Planes array. Planes are allocated in chunks so that the
175  // array does not need to be reallocated every time a new plane is added
177 
178  // The number of planes that have been added
180 
181  // Internal method used to find the position of each plane
182  void ComputePlaneDistances(vtkPolyData* 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 private:
197  vtkHull(const vtkHull&) = delete;
198  void operator=(const vtkHull&) = delete;
199 };
200 
201 #endif
double * Planes
Definition: vtkHull.h:171
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
implicit function for convex set of planes
Definition: vtkPlanes.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
int PlanesStorageSize
Definition: vtkHull.h:176
int NumberOfPlanes
Definition: vtkHull.h:179
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
produce an n-sided convex hull
Definition: vtkHull.h:52
a simple class to control print indentation
Definition: vtkIndent.h:33
object to represent cell connectivity
Definition: vtkCellArray.h:179
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.