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

# 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 =========================================================================*/
    00058 #ifndef __vtkHull_h
    00059 #define __vtkHull_h
    00060
    00061 #include "vtkPolyDataToPolyDataFilter.h"
    00062
    00063 class vtkCellArray;
    00064 class vtkPlanes;
    00065 class vtkPoints;
    00066 class vtkPolyData;
    00067
    00068 class VTK_GRAPHICS_EXPORT vtkHull : public vtkPolyDataToPolyDataFilter
    00069 {
    00070 public:
    00071   static vtkHull *New();
    00072   vtkTypeRevisionMacro(vtkHull,vtkPolyDataToPolyDataFilter);
    00073   void PrintSelf(ostream& os, vtkIndent indent);
    00074
    00076   void RemoveAllPlanes( void );
    00077
    00079
    00088   int  AddPlane( float A, float B, float C );
    00089   int  AddPlane( float plane[3] );
    00091
    00093
    00099   void SetPlane( int i, float A, float B, float C );
    00100   void SetPlane( int i, float plane[3] );
    00102
    00104
    00106   int AddPlane( float A, float B, float C, float D );
    00107   int AddPlane( float plane[3], float D );
    00108   void SetPlane( int i, float A, float B, float C, float D );
    00109   void SetPlane( int i, float plane[3], float D );
    00111
    00114   void SetPlanes( vtkPlanes *planes );
    00115
    00117
    00118   vtkGetMacro( NumberOfPlanes, int );
    00120
    00125   void AddCubeVertexPlanes();
    00126
    00131   void AddCubeEdgePlanes();
    00132
    00135   void AddCubeFacePlanes();
    00136
    00144   void AddRecursiveSpherePlanes( int level );
    00145
    00147
    00155   void GenerateHull(vtkPolyData *pd, float *bounds);
    00156   void GenerateHull(vtkPolyData *pd, float xmin, float xmax,
    00157                     float ymin, float ymax, float zmin, float zmax);
    00159
    00160 protected:
    00161   vtkHull();
    00162   ~vtkHull();
    00163
    00164   // The planes - 4 doubles per plane for A, B, C, D
    00165   double     *Planes;
    00166
    00167   // This indicates the current size (in planes - 4*sizeof(float)) of
    00168   // the this->Planes array. Planes are allocated in chunks so that the
    00169   // array does not need to be reallocated every time a new plane is added
    00170   int       PlanesStorageSize;
    00171
    00172   // The number of planes that have been added
    00173   int       NumberOfPlanes;
    00174
    00175   // Internal method used to find the position of each plane
    00176   void      ComputePlaneDistances();
    00177
    00178   // Internal method used to create the actual polygons from the set
    00179   // of planes
    00180   void      ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys,
    00181                                     float *bounds );
    00182
    00183   // Internal method used to create the initial "big" polygon from the
    00184   // plane equation. This polygon is clipped by all other planes to form
    00185   // the final polygon (or it may be clipped entirely)
    00186   void      CreateInitialPolygon( double *, int, float * );
    00187
    00188   // The method that does it all...
    00189   void      Execute();
    00190 private:
    00191   vtkHull(const vtkHull&);  // Not implemented.
    00192   void operator=(const vtkHull&);  // Not implemented.
    00193 };
    00194
    00195 #endif