VTK
dox/Graphics/vtkDelaunay3D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDelaunay3D.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 =========================================================================*/
00096 #ifndef __vtkDelaunay3D_h
00097 #define __vtkDelaunay3D_h
00098 
00099 #include "vtkUnstructuredGridAlgorithm.h"
00100 
00101 class vtkIdList;
00102 class vtkPointLocator;
00103 class vtkPointSet;
00104 class vtkPoints;
00105 class vtkTetraArray;
00106 class vtkIncrementalPointLocator;
00107 
00108 class VTK_GRAPHICS_EXPORT vtkDelaunay3D : public vtkUnstructuredGridAlgorithm
00109 {
00110 public:
00111   vtkTypeMacro(vtkDelaunay3D,vtkUnstructuredGridAlgorithm);
00112   void PrintSelf(ostream& os, vtkIndent indent);
00113 
00116   static vtkDelaunay3D *New();
00117 
00119 
00123   vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
00124   vtkGetMacro(Alpha,double);
00126 
00128 
00131   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00132   vtkGetMacro(Tolerance,double);
00134 
00136 
00138   vtkSetClampMacro(Offset,double,2.5,VTK_DOUBLE_MAX);
00139   vtkGetMacro(Offset,double);
00141 
00143 
00147   vtkSetMacro(BoundingTriangulation,int);
00148   vtkGetMacro(BoundingTriangulation,int);
00149   vtkBooleanMacro(BoundingTriangulation,int);
00151 
00153 
00155   void SetLocator(vtkIncrementalPointLocator *locator);
00156   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00158 
00161   void CreateDefaultLocator();
00162 
00164 
00174   vtkUnstructuredGrid *InitPointInsertion(double center[3], double length, 
00175                                           vtkIdType numPts, vtkPoints* &pts);
00177 
00179 
00188   void InsertPoint(vtkUnstructuredGrid *Mesh, vtkPoints *points,
00189                    vtkIdType id, double x[3], vtkIdList *holeTetras);
00191 
00196   void EndPointInsertion();
00197 
00199   unsigned long GetMTime();
00200 
00201 protected:
00202   vtkDelaunay3D();
00203   ~vtkDelaunay3D();
00204 
00205   int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00206 
00207   double Alpha;
00208   double Tolerance;
00209   int BoundingTriangulation;
00210   double Offset;
00211 
00212   vtkIncrementalPointLocator *Locator;  //help locate points faster
00213   
00214   vtkTetraArray *TetraArray; //used to keep track of circumspheres/neighbors
00215   int FindTetra(vtkUnstructuredGrid *Mesh, double x[3], vtkIdType tetId,
00216                 int depth);
00217   int InSphere(double x[3], vtkIdType tetraId);
00218   void InsertTetra(vtkUnstructuredGrid *Mesh, vtkPoints *pts,
00219                    vtkIdType tetraId);
00220 
00221   int NumberOfDuplicatePoints; //keep track of bad data
00222   int NumberOfDegeneracies;
00223 
00224   // Keep track of number of references to points to avoid new/delete calls
00225   int *References;
00226 
00227   vtkIdType FindEnclosingFaces(double x[3], vtkUnstructuredGrid *Mesh,
00228                                vtkIdList *tetras, vtkIdList *faces, 
00229                                vtkIncrementalPointLocator *Locator);
00230 
00231   virtual int FillInputPortInformation(int, vtkInformation*);
00232 private: //members added for performance
00233   vtkIdList *Tetras; //used in InsertPoint
00234   vtkIdList *Faces;  //used in InsertPoint
00235   vtkIdList *BoundaryPts; //used by InsertPoint
00236   vtkIdList *CheckedTetras; //used by InsertPoint
00237   vtkIdList *NeiTetras; //used by InsertPoint
00238 
00239 private:
00240   vtkDelaunay3D(const vtkDelaunay3D&);  // Not implemented.
00241   void operator=(const vtkDelaunay3D&);  // Not implemented.
00242 };
00243 
00244 #endif
00245 
00246