VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDelaunay3D.h,v $ 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 =========================================================================*/ 00093 #ifndef __vtkDelaunay3D_h 00094 #define __vtkDelaunay3D_h 00095 00096 #include "vtkUnstructuredGridAlgorithm.h" 00097 00098 class vtkIdList; 00099 class vtkPointLocator; 00100 class vtkPointSet; 00101 class vtkPoints; 00102 class vtkTetraArray; 00103 00104 class VTK_GRAPHICS_EXPORT vtkDelaunay3D : public vtkUnstructuredGridAlgorithm 00105 { 00106 public: 00107 vtkTypeRevisionMacro(vtkDelaunay3D,vtkUnstructuredGridAlgorithm); 00108 void PrintSelf(ostream& os, vtkIndent indent); 00109 00112 static vtkDelaunay3D *New(); 00113 00115 00119 vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX); 00120 vtkGetMacro(Alpha,double); 00122 00124 00127 vtkSetClampMacro(Tolerance,double,0.0,1.0); 00128 vtkGetMacro(Tolerance,double); 00130 00132 00134 vtkSetClampMacro(Offset,double,2.5,VTK_DOUBLE_MAX); 00135 vtkGetMacro(Offset,double); 00137 00139 00143 vtkSetMacro(BoundingTriangulation,int); 00144 vtkGetMacro(BoundingTriangulation,int); 00145 vtkBooleanMacro(BoundingTriangulation,int); 00147 00149 00151 void SetLocator(vtkPointLocator *locator); 00152 vtkGetObjectMacro(Locator,vtkPointLocator); 00154 00157 void CreateDefaultLocator(); 00158 00160 00170 vtkUnstructuredGrid *InitPointInsertion(double center[3], double length, 00171 vtkIdType numPts, vtkPoints* &pts); 00173 00175 00184 void InsertPoint(vtkUnstructuredGrid *Mesh, vtkPoints *points, 00185 vtkIdType id, double x[3], vtkIdList *holeTetras); 00187 00192 void EndPointInsertion(); 00193 00195 unsigned long GetMTime(); 00196 00197 protected: 00198 vtkDelaunay3D(); 00199 ~vtkDelaunay3D(); 00200 00201 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00202 00203 double Alpha; 00204 double Tolerance; 00205 int BoundingTriangulation; 00206 double Offset; 00207 00208 vtkPointLocator *Locator; //help locate points faster 00209 00210 vtkTetraArray *TetraArray; //used to keep track of circumspheres/neighbors 00211 int FindTetra(vtkUnstructuredGrid *Mesh, double x[3], vtkIdType tetId, 00212 int depth); 00213 int InSphere(double x[3], vtkIdType tetraId); 00214 void InsertTetra(vtkUnstructuredGrid *Mesh, vtkPoints *pts, 00215 vtkIdType tetraId); 00216 00217 int NumberOfDuplicatePoints; //keep track of bad data 00218 int NumberOfDegeneracies; 00219 00220 // Keep track of number of references to points to avoid new/delete calls 00221 int *References; 00222 00223 vtkIdType FindEnclosingFaces(double x[3], vtkUnstructuredGrid *Mesh, 00224 vtkIdList *tetras, vtkIdList *faces, 00225 vtkPointLocator *Locator); 00226 00227 virtual int FillInputPortInformation(int, vtkInformation*); 00228 private: //members added for performance 00229 vtkIdList *Tetras; //used in InsertPoint 00230 vtkIdList *Faces; //used in InsertPoint 00231 vtkIdList *BoundaryPts; //used by InsertPoint 00232 vtkIdList *CheckedTetras; //used by InsertPoint 00233 vtkIdList *NeiTetras; //used by InsertPoint 00234 00235 private: 00236 vtkDelaunay3D(const vtkDelaunay3D&); // Not implemented. 00237 void operator=(const vtkDelaunay3D&); // Not implemented. 00238 }; 00239 00240 #endif 00241 00242