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

dox/Graphics/vtkHull.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkHull.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00047 #ifndef __vtkHull_h
00048 #define __vtkHull_h
00049 
00050 #include "vtkPolyDataToPolyDataFilter.h"
00051 
00052 class vtkCellArray;
00053 class vtkPlanes;
00054 class vtkPoints;
00055 class vtkPolyData;
00056 
00057 class VTK_GRAPHICS_EXPORT vtkHull : public vtkPolyDataToPolyDataFilter
00058 {
00059 public:
00060   static vtkHull *New();
00061   vtkTypeRevisionMacro(vtkHull,vtkPolyDataToPolyDataFilter);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063 
00065   void RemoveAllPlanes( void );
00066 
00068 
00077   int  AddPlane( float A, float B, float C );
00078   int  AddPlane( float plane[3] );
00080 
00082 
00088   void SetPlane( int i, float A, float B, float C );
00089   void SetPlane( int i, float plane[3] );
00091 
00093 
00095   int AddPlane( float A, float B, float C, float D );
00096   int AddPlane( float plane[3], float D );
00097   void SetPlane( int i, float A, float B, float C, float D );
00098   void SetPlane( int i, float plane[3], float D );
00100 
00103   void SetPlanes( vtkPlanes *planes );
00104 
00106 
00107   vtkGetMacro( NumberOfPlanes, int );
00109   
00114   void AddCubeVertexPlanes();
00115 
00120   void AddCubeEdgePlanes();
00121 
00124   void AddCubeFacePlanes();
00125 
00133   void AddRecursiveSpherePlanes( int level );
00134 
00136 
00144   void GenerateHull(vtkPolyData *pd, float *bounds);
00145   void GenerateHull(vtkPolyData *pd, float xmin, float xmax,
00146                     float ymin, float ymax, float zmin, float zmax);
00148 
00149 protected:
00150   vtkHull();
00151   ~vtkHull();
00152 
00153   // The planes - 4 doubles per plane for A, B, C, D
00154   double     *Planes;
00155 
00156   // This indicates the current size (in planes - 4*sizeof(float)) of 
00157   // the this->Planes array. Planes are allocated in chunks so that the
00158   // array does not need to be reallocated every time a new plane is added
00159   int       PlanesStorageSize;
00160 
00161   // The number of planes that have been added
00162   int       NumberOfPlanes;
00163 
00164   // Internal method used to find the position of each plane
00165   void      ComputePlaneDistances();
00166 
00167   // Internal method used to create the actual polygons from the set 
00168   // of planes
00169   void      ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
00170                                     float *bounds );
00171 
00172   // Internal method used to create the initial "big" polygon from the
00173   // plane equation. This polygon is clipped by all other planes to form
00174   // the final polygon (or it may be clipped entirely)
00175   void      CreateInitialPolygon( double *, int, float * );
00176 
00177   // The method that does it all...
00178   void      Execute();
00179 private:
00180   vtkHull(const vtkHull&);  // Not implemented.
00181   void operator=(const vtkHull&);  // Not implemented.
00182 };
00183 
00184 #endif