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 "vtkPolyDataAlgorithm.h"
47 
48 class vtkCellArray;
49 class vtkPlanes;
50 class vtkPoints;
51 class vtkPolyData;
52 
54 {
55 public:
56  static vtkHull *New();
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
61  void RemoveAllPlanes( void );
62 
64 
73  int AddPlane( double A, double B, double C );
74  int AddPlane( double plane[3] );
76 
78 
84  void SetPlane( int i, double A, double B, double C );
85  void SetPlane( int i, double plane[3] );
87 
89 
91  int AddPlane( double A, double B, double C, double D );
92  int AddPlane( double plane[3], double D );
93  void SetPlane( int i, double A, double B, double C, double D );
94  void SetPlane( int i, double plane[3], double D );
96 
99  void SetPlanes( vtkPlanes *planes );
100 
102 
103  vtkGetMacro( NumberOfPlanes, int );
105 
110  void AddCubeVertexPlanes();
111 
116  void AddCubeEdgePlanes();
117 
120  void AddCubeFacePlanes();
121 
129  void AddRecursiveSpherePlanes( int level );
130 
132 
140  void GenerateHull(vtkPolyData *pd, double *bounds);
141  void GenerateHull(vtkPolyData *pd, double xmin, double xmax,
142  double ymin, double ymax, double zmin, double zmax);
144 
145 protected:
146  vtkHull();
147  ~vtkHull();
148 
149  // The planes - 4 doubles per plane for A, B, C, D
150  double *Planes;
151 
152  // This indicates the current size (in planes - 4*sizeof(double)) of
153  // the this->Planes array. Planes are allocated in chunks so that the
154  // array does not need to be reallocated every time a new plane is added
156 
157  // The number of planes that have been added
159 
160  // Internal method used to find the position of each plane
161  void ComputePlaneDistances(vtkPolyData *input);
162 
163  // Internal method used to create the actual polygons from the set
164  // of planes
165  void ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
166  double *bounds );
167 
168  // Internal method used to create the initial "big" polygon from the
169  // plane equation. This polygon is clipped by all other planes to form
170  // the final polygon (or it may be clipped entirely)
171  void CreateInitialPolygon( double *, int, double * );
172 
173  // The method that does it all...
175 private:
176  vtkHull(const vtkHull&); // Not implemented.
177  void operator=(const vtkHull&); // Not implemented.
178 };
179 
180 #endif
double * Planes
Definition: vtkHull.h:150
#define VTK_GRAPHICS_EXPORT
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
implicit function for convex set of planes
Definition: vtkPlanes.h:52
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
int PlanesStorageSize
Definition: vtkHull.h:155
int NumberOfPlanes
Definition: vtkHull.h:158
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:53
a simple class to control print indentation
Definition: vtkIndent.h:37
object to represent cell connectivity
Definition: vtkCellArray.h:48
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:38