VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkHull.h 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 =========================================================================*/ 00043 #ifndef vtkHull_h 00044 #define vtkHull_h 00045 00046 #include "vtkFiltersCoreModule.h" // For export macro 00047 #include "vtkPolyDataAlgorithm.h" 00048 00049 class vtkCellArray; 00050 class vtkPlanes; 00051 class vtkPoints; 00052 class vtkPolyData; 00053 00054 class VTKFILTERSCORE_EXPORT vtkHull : public vtkPolyDataAlgorithm 00055 { 00056 public: 00057 static vtkHull *New(); 00058 vtkTypeMacro(vtkHull,vtkPolyDataAlgorithm); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00060 00062 void RemoveAllPlanes( void ); 00063 00065 00074 int AddPlane( double A, double B, double C ); 00075 int AddPlane( double plane[3] ); 00077 00079 00085 void SetPlane( int i, double A, double B, double C ); 00086 void SetPlane( int i, double plane[3] ); 00088 00090 00092 int AddPlane( double A, double B, double C, double D ); 00093 int AddPlane( double plane[3], double D ); 00094 void SetPlane( int i, double A, double B, double C, double D ); 00095 void SetPlane( int i, double plane[3], double D ); 00097 00100 void SetPlanes( vtkPlanes *planes ); 00101 00103 00104 vtkGetMacro( NumberOfPlanes, int ); 00106 00111 void AddCubeVertexPlanes(); 00112 00117 void AddCubeEdgePlanes(); 00118 00121 void AddCubeFacePlanes(); 00122 00130 void AddRecursiveSpherePlanes( int level ); 00131 00133 00141 void GenerateHull(vtkPolyData *pd, double *bounds); 00142 void GenerateHull(vtkPolyData *pd, double xmin, double xmax, 00143 double ymin, double ymax, double zmin, double zmax); 00145 00146 protected: 00147 vtkHull(); 00148 ~vtkHull(); 00149 00150 // The planes - 4 doubles per plane for A, B, C, D 00151 double *Planes; 00152 00153 // This indicates the current size (in planes - 4*sizeof(double)) of 00154 // the this->Planes array. Planes are allocated in chunks so that the 00155 // array does not need to be reallocated every time a new plane is added 00156 int PlanesStorageSize; 00157 00158 // The number of planes that have been added 00159 int NumberOfPlanes; 00160 00161 // Internal method used to find the position of each plane 00162 void ComputePlaneDistances(vtkPolyData *input); 00163 00164 // Internal method used to create the actual polygons from the set 00165 // of planes 00166 void ClipPolygonsFromPlanes( vtkPoints *points, vtkCellArray *polys, 00167 double *bounds ); 00168 00169 // Internal method used to create the initial "big" polygon from the 00170 // plane equation. This polygon is clipped by all other planes to form 00171 // the final polygon (or it may be clipped entirely) 00172 void CreateInitialPolygon( double *, int, double * ); 00173 00174 // The method that does it all... 00175 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00176 private: 00177 vtkHull(const vtkHull&); // Not implemented. 00178 void operator=(const vtkHull&); // Not implemented. 00179 }; 00180 00181 #endif