Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkHull.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkHull.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00054 #ifndef __vtkHull_h
00055 #define __vtkHull_h
00056 
00057 #include "vtkPolyDataToPolyDataFilter.h"
00058 
00059 class vtkCellArray;
00060 class vtkPlanes;
00061 class vtkPoints;
00062 class vtkPolyData;
00063 
00064 class VTK_GRAPHICS_EXPORT vtkHull : public vtkPolyDataToPolyDataFilter
00065 {
00066 public:
00067   static vtkHull *New();
00068   vtkTypeRevisionMacro(vtkHull,vtkPolyDataToPolyDataFilter);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00072   void RemoveAllPlanes( void );
00073 
00075 
00084   int  AddPlane( double A, double B, double C );
00085   int  AddPlane( double plane[3] );
00087 
00089 
00095   void SetPlane( int i, double A, double B, double C );
00096   void SetPlane( int i, double plane[3] );
00098 
00100 
00102   int AddPlane( double A, double B, double C, double D );
00103   int AddPlane( double plane[3], double D );
00104   void SetPlane( int i, double A, double B, double C, double D );
00105   void SetPlane( int i, double plane[3], double D );
00107 
00110   void SetPlanes( vtkPlanes *planes );
00111 
00113 
00114   vtkGetMacro( NumberOfPlanes, int );
00116   
00121   void AddCubeVertexPlanes();
00122 
00127   void AddCubeEdgePlanes();
00128 
00131   void AddCubeFacePlanes();
00132 
00140   void AddRecursiveSpherePlanes( int level );
00141 
00143 
00151   void GenerateHull(vtkPolyData *pd, double *bounds);
00152   void GenerateHull(vtkPolyData *pd, double xmin, double xmax,
00153                     double ymin, double ymax, double zmin, double zmax);
00155 
00156 protected:
00157   vtkHull();
00158   ~vtkHull();
00159 
00160   // The planes - 4 doubles per plane for A, B, C, D
00161   double     *Planes;
00162 
00163   // This indicates the current size (in planes - 4*sizeof(double)) of 
00164   // the this->Planes array. Planes are allocated in chunks so that the
00165   // array does not need to be reallocated every time a new plane is added
00166   int       PlanesStorageSize;
00167 
00168   // The number of planes that have been added
00169   int       NumberOfPlanes;
00170 
00171   // Internal method used to find the position of each plane
00172   void      ComputePlaneDistances();
00173 
00174   // Internal method used to create the actual polygons from the set 
00175   // of planes
00176   void      ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
00177                                     double *bounds );
00178 
00179   // Internal method used to create the initial "big" polygon from the
00180   // plane equation. This polygon is clipped by all other planes to form
00181   // the final polygon (or it may be clipped entirely)
00182   void      CreateInitialPolygon( double *, int, double * );
00183 
00184   // The method that does it all...
00185   void      Execute();
00186 private:
00187   vtkHull(const vtkHull&);  // Not implemented.
00188   void operator=(const vtkHull&);  // Not implemented.
00189 };
00190 
00191 #endif