Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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 =========================================================================*/
00130 #ifndef __vtkDelaunay2D_h
00131 #define __vtkDelaunay2D_h
00132 
00133 #include "vtkPolyDataSource.h"
00134 
00135 class vtkAbstractTransform;
00136 class vtkCellArray;
00137 class vtkIdList;
00138 class vtkPointSet;
00139 
00140 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00141 {
00142 public:
00143   vtkTypeRevisionMacro(vtkDelaunay2D,vtkPolyDataSource);
00144   void PrintSelf(ostream& os, vtkIndent indent);
00145 
00148   static vtkDelaunay2D *New();
00149 
00151 
00156   void SetSource(vtkPolyData *);
00157   vtkPolyData *GetSource();
00159   
00161 
00165   vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
00166   vtkGetMacro(Alpha,double);
00168 
00170 
00173   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00174   vtkGetMacro(Tolerance,double);
00176 
00178 
00180   vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
00181   vtkGetMacro(Offset,double);
00183 
00185 
00189   vtkSetMacro(BoundingTriangulation,int);
00190   vtkGetMacro(BoundingTriangulation,int);
00191   vtkBooleanMacro(BoundingTriangulation,int);
00193 
00195 
00196   virtual void SetInput(vtkPointSet *input);
00197   vtkPointSet *GetInput();
00199 
00201 
00209   virtual void SetTransform(vtkAbstractTransform*);
00210   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00212 
00213 protected:
00214   vtkDelaunay2D();
00215   ~vtkDelaunay2D();
00216 
00217   void Execute();
00218 
00219   double Alpha;
00220   double Tolerance;
00221   int BoundingTriangulation;
00222   double Offset;
00223 
00224   vtkAbstractTransform *Transform;
00225 
00226 private:
00227   vtkPolyData *Mesh; //the created mesh
00228   double *Points;    //the raw points in double precision
00229   void SetPoint(vtkIdType id, double *x)
00230     {vtkIdType idx=3*id; 
00231     this->Points[idx] = x[0];
00232     this->Points[idx+1] = x[1];
00233     this->Points[idx+2] = x[2];
00234     }
00235       
00236   void GetPoint(vtkIdType id, double x[3])
00237     {double *ptr = this->Points + 3*id;
00238     x[0] = *ptr++;
00239     x[1] = *ptr++;
00240     x[2] = *ptr;
00241     }
00242 
00243   int NumberOfDuplicatePoints;
00244   int NumberOfDegeneracies;
00245 
00246   int *RecoverBoundary();
00247   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00248   void FillPolygons(vtkCellArray *polys, int *triUse);
00249 
00250   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00251   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00252                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00253   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00254                  vtkIdType tri);
00255 
00256 private:
00257   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00258   void operator=(const vtkDelaunay2D&);  // Not implemented.
00259 };
00260 
00261 #endif
00262 
00263