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 =========================================================================*/
43 #ifndef vtkHull_h
44 #define vtkHull_h
45 
46 #include "vtkFiltersCoreModule.h" // For export macro
47 #include "vtkPolyDataAlgorithm.h"
48 
49 class vtkCellArray;
50 class vtkPlanes;
51 class vtkPoints;
52 class vtkPolyData;
53 
55 {
56 public:
57  static vtkHull *New();
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62  void RemoveAllPlanes( void );
63 
65 
74  int AddPlane( double A, double B, double C );
75  int AddPlane( double plane[3] );
77 
79 
85  void SetPlane( int i, double A, double B, double C );
86  void SetPlane( int i, double plane[3] );
88 
90 
92  int AddPlane( double A, double B, double C, double D );
93  int AddPlane( double plane[3], double D );
94  void SetPlane( int i, double A, double B, double C, double D );
95  void SetPlane( int i, double plane[3], double D );
97 
100  void SetPlanes( vtkPlanes *planes );
101 
103 
104  vtkGetMacro( NumberOfPlanes, int );
106 
111  void AddCubeVertexPlanes();
112 
117  void AddCubeEdgePlanes();
118 
121  void AddCubeFacePlanes();
122 
130  void AddRecursiveSpherePlanes( int level );
131 
133 
141  void GenerateHull(vtkPolyData *pd, double *bounds);
142  void GenerateHull(vtkPolyData *pd, double xmin, double xmax,
143  double ymin, double ymax, double zmin, double zmax);
145 
146 protected:
147  vtkHull();
148  ~vtkHull();
149 
150  // The planes - 4 doubles per plane for A, B, C, D
151  double *Planes;
152 
153  // This indicates the current size (in planes - 4*sizeof(double)) of
154  // the this->Planes array. Planes are allocated in chunks so that the
155  // array does not need to be reallocated every time a new plane is added
157 
158  // The number of planes that have been added
160 
161  // Internal method used to find the position of each plane
162  void ComputePlaneDistances(vtkPolyData *input);
163 
164  // Internal method used to create the actual polygons from the set
165  // of planes
166  void ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
167  double *bounds );
168 
169  // Internal method used to create the initial "big" polygon from the
170  // plane equation. This polygon is clipped by all other planes to form
171  // the final polygon (or it may be clipped entirely)
172  void CreateInitialPolygon( double *, int, double * );
173 
174  // The method that does it all...
176 private:
177  vtkHull(const vtkHull&); // Not implemented.
178  void operator=(const vtkHull&); // Not implemented.
179 };
180 
181 #endif
double * Planes
Definition: vtkHull.h:151
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTKFILTERSCORE_EXPORT
implicit function for convex set of planes
Definition: vtkPlanes.h:53
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
int PlanesStorageSize
Definition: vtkHull.h:156
int NumberOfPlanes
Definition: vtkHull.h:159
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only polydata as output.
produce an n-sided convex hull
Definition: vtkHull.h:54
a simple class to control print indentation
Definition: vtkIndent.h:38
object to represent cell connectivity
Definition: vtkCellArray.h:49
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:38