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

Graphics/vtkDelaunay2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDelaunay2D.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00146 #ifndef __vtkDelaunay2D_h
00147 #define __vtkDelaunay2D_h
00148 
00149 #include "vtkPolyDataSource.h"
00150 
00151 class vtkAbstractTransform;
00152 class vtkCellArray;
00153 class vtkIdList;
00154 class vtkPointSet;
00155 
00156 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00157 {
00158 public:
00159   vtkTypeRevisionMacro(vtkDelaunay2D,vtkPolyDataSource);
00160   void PrintSelf(ostream& os, vtkIndent indent);
00161 
00164   static vtkDelaunay2D *New();
00165 
00167 
00172   void SetSource(vtkPolyData *);
00173   vtkPolyData *GetSource();
00175   
00177 
00181   vtkSetClampMacro(Alpha,double,0.0,VTK_LARGE_FLOAT);
00182   vtkGetMacro(Alpha,double);
00184 
00186 
00189   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00190   vtkGetMacro(Tolerance,double);
00192 
00194 
00196   vtkSetClampMacro(Offset,double,0.75,VTK_LARGE_FLOAT);
00197   vtkGetMacro(Offset,double);
00199 
00201 
00205   vtkSetMacro(BoundingTriangulation,int);
00206   vtkGetMacro(BoundingTriangulation,int);
00207   vtkBooleanMacro(BoundingTriangulation,int);
00209 
00211 
00212   virtual void SetInput(vtkPointSet *input);
00213   vtkPointSet *GetInput();
00215 
00217 
00225   virtual void SetTransform(vtkAbstractTransform*);
00226   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00228 
00229 protected:
00230   vtkDelaunay2D();
00231   ~vtkDelaunay2D();
00232 
00233   void Execute();
00234 
00235   double Alpha;
00236   double Tolerance;
00237   int BoundingTriangulation;
00238   double Offset;
00239 
00240   vtkAbstractTransform *Transform;
00241 
00242 private:
00243   vtkPolyData *Mesh; //the created mesh
00244   double *Points;    //the raw points in double precision
00245   void SetPoint(vtkIdType id, double *x)
00246     {vtkIdType idx=3*id; 
00247     this->Points[idx] = x[0];
00248     this->Points[idx+1] = x[1];
00249     this->Points[idx+2] = x[2];
00250     }
00251       
00252   void GetPoint(vtkIdType id, double x[3])
00253     {double *ptr = this->Points + 3*id;
00254     x[0] = *ptr++;
00255     x[1] = *ptr++;
00256     x[2] = *ptr;
00257     }
00258 
00259   int NumberOfDuplicatePoints;
00260   int NumberOfDegeneracies;
00261 
00262   int *RecoverBoundary();
00263   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00264   void FillPolygons(vtkCellArray *polys, int *triUse);
00265 
00266   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00267   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00268                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00269   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00270                  vtkIdType tri);
00271 
00272 private:
00273   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00274   void operator=(const vtkDelaunay2D&);  // Not implemented.
00275 };
00276 
00277 #endif
00278 
00279