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

graphics/vtkDelaunay3D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDelaunay3D.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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;  //help locate points faster
00253   
00254   vtkTetraArray *TetraArray; //used to keep track of circumspheres/neighbors
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; //keep track of bad data
00260   int NumberOfDegeneracies;
00261 
00262   // Keep track of number of references to points to avoid new/delete calls
00263   int *References;
00264 
00265   int FindEnclosingFaces(float x[3], vtkUnstructuredGrid *Mesh,
00266                          vtkIdList *tetras, vtkIdList *faces, 
00267                          vtkPointLocator *Locator);
00268   
00269 private: //members added for performance
00270   vtkIdList *Tetras; //used in InsertPoint
00271   vtkIdList *Faces;  //used in InsertPoint
00272   vtkIdList *BoundaryPts; //used by InsertPoint
00273   vtkIdList *CheckedTetras; //used by InsertPoint
00274   vtkIdList *NeiTetras; //used by InsertPoint
00275 
00276 };
00277 
00278 #endif
00279 
00280 

Generated on Wed Nov 21 12:26:58 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001