VTK
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 "vtkPolyDataAlgorithm.h"
49 
50 class vtkCellArray;
51 class vtkPlanes;
52 class vtkPoints;
53 class vtkPolyData;
54 
55 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm
56 {
57 public:
58  static vtkHull *New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
65  void RemoveAllPlanes( void );
66 
68 
79  int AddPlane( double A, double B, double C );
80  int AddPlane( double plane[3] );
82 
84 
92  void SetPlane( int i, double A, double B, double C );
93  void SetPlane( int i, double plane[3] );
95 
97 
101  int AddPlane( double A, double B, double C, double D );
102  int AddPlane( double plane[3], double D );
103  void SetPlane( int i, double A, double B, double C, double D );
104  void SetPlane( int i, double plane[3], double D );
106 
111  void SetPlanes( vtkPlanes *planes );
112 
114 
117  vtkGetMacro( NumberOfPlanes, int );
119 
125  void AddCubeVertexPlanes();
126 
133  void AddCubeEdgePlanes();
134 
139  void AddCubeFacePlanes();
140 
150  void AddRecursiveSpherePlanes( int level );
151 
153 
164  void GenerateHull(vtkPolyData *pd, double *bounds);
165  void GenerateHull(vtkPolyData *pd, double xmin, double xmax,
166  double ymin, double ymax, double zmin, double zmax);
168 
169 protected:
170  vtkHull();
171  ~vtkHull() VTK_OVERRIDE;
172 
173  // The planes - 4 doubles per plane for A, B, C, D
174  double *Planes;
175 
176  // This indicates the current size (in planes - 4*sizeof(double)) of
177  // the this->Planes array. Planes are allocated in chunks so that the
178  // array does not need to be reallocated every time a new plane is added
179  int PlanesStorageSize;
180 
181  // The number of planes that have been added
182  int NumberOfPlanes;
183 
184  // Internal method used to find the position of each plane
185  void ComputePlaneDistances(vtkPolyData *input);
186 
187  // Internal method used to create the actual polygons from the set
188  // of planes
189  void ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
190  double *bounds );
191 
192  // Internal method used to create the initial "big" polygon from the
193  // plane equation. This polygon is clipped by all other planes to form
194  // the final polygon (or it may be clipped entirely)
195  void CreateInitialPolygon( double *, int, double * );
196 
197  // The method that does it all...
198  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
199 private:
200  vtkHull(const vtkHull&) VTK_DELETE_FUNCTION;
201  void operator=(const vtkHull&) VTK_DELETE_FUNCTION;
202 };
203 
204 #endif
Store vtkAlgorithm input/output information.
implicit function for convex set of planes
Definition: vtkPlanes.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
produce an n-sided convex hull
Definition: vtkHull.h:55
a simple class to control print indentation
Definition: vtkIndent.h:39
object to represent cell connectivity
Definition: vtkCellArray.h:50
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.