00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00118 #ifndef __vtkDelaunay3D_h
00119 #define __vtkDelaunay3D_h
00120 
00121 #include "vtkUnstructuredGridSource.h"
00122 
00123 class vtkTetraArray;
00124 
00125 class VTK_EXPORT vtkDelaunay3D : public vtkUnstructuredGridSource
00126 {
00127 public:
00128   vtkTypeMacro(vtkDelaunay3D,vtkUnstructuredGridSource);
00129   void PrintSelf(ostream& os, vtkIndent indent);
00130 
00133   static vtkDelaunay3D *New();
00134 
00139   vtkSetClampMacro(Alpha,float,0.0,VTK_LARGE_FLOAT);
00140   vtkGetMacro(Alpha,float);
00141 
00145   vtkSetClampMacro(Tolerance,float,0.0,1.0);
00146   vtkGetMacro(Tolerance,float);
00147 
00150   vtkSetClampMacro(Offset,float,2.5,VTK_LARGE_FLOAT);
00151   vtkGetMacro(Offset,float);
00152 
00157   vtkSetMacro(BoundingTriangulation,int);
00158   vtkGetMacro(BoundingTriangulation,int);
00159   vtkBooleanMacro(BoundingTriangulation,int);
00160 
00163   void SetLocator(vtkPointLocator *locator);
00164   vtkGetObjectMacro(Locator,vtkPointLocator);
00165 
00168   void CreateDefaultLocator();
00169 
00180   vtkUnstructuredGrid *InitPointInsertion(float center[3], float length, 
00181                                           int numPts, vtkPoints* &pts);
00182 
00195   vtkUnstructuredGrid *InitPointInsertion(int numPtsToInsert,  int numTetra,
00196                           vtkPoints *boundingTetraPts, float bounds[6],
00197                           vtkPoints* &pts);
00198   
00208   void InsertPoint(vtkUnstructuredGrid *Mesh, vtkPoints *points,
00209                    int id, float x[3], vtkIdList *holeTetras);
00210 
00215   void EndPointInsertion();
00216 
00218   unsigned long GetMTime();
00219 
00221   virtual void SetInput(vtkPointSet *input);
00222   vtkPointSet *GetInput();
00223 
00224 #ifndef VTK_REMOVE_LEGACY_CODE
00225 
00226   void SetLocator(vtkPointLocator& locator) 
00227     {VTK_LEGACY_METHOD(SetLocator,"3.2"); this->SetLocator(&locator);}
00228   vtkUnstructuredGrid *InitPointInsertion(int numPtsToInsert,  int numTetra,
00229                                           vtkPoints &boundingTetraPts, 
00230                                           float bounds[6], vtkPoints* &pts) 
00231     {VTK_LEGACY_METHOD(InitPointInsertion,"3.2"); 
00232     return this->InitPointInsertion(numPtsToInsert, numTetra, 
00233                                     &boundingTetraPts, bounds, pts);}
00234   void InsertPoint(vtkUnstructuredGrid *Mesh, vtkPoints *points,
00235                    int id, float x[3], vtkIdList &holeTetras) 
00236     {VTK_LEGACY_METHOD(InsertPoint,"3.2"); this->InsertPoint(Mesh, points, id, x, &holeTetras);}
00237 #endif
00238   
00239 protected:
00240   vtkDelaunay3D();
00241   ~vtkDelaunay3D();
00242   vtkDelaunay3D(const vtkDelaunay3D&) {};
00243   void operator=(const vtkDelaunay3D&) {};
00244 
00245   void Execute();
00246 
00247   float Alpha;
00248   float Tolerance;
00249   int BoundingTriangulation;
00250   float Offset;
00251 
00252   vtkPointLocator *Locator;  
00253   
00254   vtkTetraArray *TetraArray; 
00255   int FindTetra(vtkUnstructuredGrid *Mesh, double x[3], int tetId, int depth);
00256   int InSphere(double x[3], int tetraId);
00257   void InsertTetra(vtkUnstructuredGrid *Mesh, vtkPoints *pts, int tetraId);
00258 
00259   int NumberOfDuplicatePoints; 
00260   int NumberOfDegeneracies;
00261 
00262   
00263   int *References;
00264 
00265   int FindEnclosingFaces(float x[3], vtkUnstructuredGrid *Mesh,
00266                          vtkIdList *tetras, vtkIdList *faces, 
00267                          vtkPointLocator *Locator);
00268   
00269 private: 
00270   vtkIdList *Tetras; 
00271   vtkIdList *Faces;  
00272   vtkIdList *BoundaryPts; 
00273   vtkIdList *CheckedTetras; 
00274   vtkIdList *NeiTetras; 
00275 
00276 };
00277 
00278 #endif
00279 
00280