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

dox/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 =========================================================================*/
00134 #ifndef __vtkDelaunay2D_h
00135 #define __vtkDelaunay2D_h
00136 
00137 #include "vtkPolyDataSource.h"
00138 
00139 class vtkAbstractTransform;
00140 class vtkCellArray;
00141 class vtkIdList;
00142 class vtkPointSet;
00143 
00144 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00145 {
00146 public:
00147   vtkTypeRevisionMacro(vtkDelaunay2D,vtkPolyDataSource);
00148   void PrintSelf(ostream& os, vtkIndent indent);
00149 
00152   static vtkDelaunay2D *New();
00153 
00155 
00160   void SetSource(vtkPolyData *);
00161   vtkPolyData *GetSource();
00163   
00165 
00169   vtkSetClampMacro(Alpha,double,0.0,VTK_LARGE_FLOAT);
00170   vtkGetMacro(Alpha,double);
00172 
00174 
00177   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00178   vtkGetMacro(Tolerance,double);
00180 
00182 
00184   vtkSetClampMacro(Offset,double,0.75,VTK_LARGE_FLOAT);
00185   vtkGetMacro(Offset,double);
00187 
00189 
00193   vtkSetMacro(BoundingTriangulation,int);
00194   vtkGetMacro(BoundingTriangulation,int);
00195   vtkBooleanMacro(BoundingTriangulation,int);
00197 
00199 
00200   virtual void SetInput(vtkPointSet *input);
00201   vtkPointSet *GetInput();
00203 
00205 
00213   virtual void SetTransform(vtkAbstractTransform*);
00214   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00216 
00217 protected:
00218   vtkDelaunay2D();
00219   ~vtkDelaunay2D();
00220 
00221   void Execute();
00222 
00223   double Alpha;
00224   double Tolerance;
00225   int BoundingTriangulation;
00226   double Offset;
00227 
00228   vtkAbstractTransform *Transform;
00229 
00230 private:
00231   vtkPolyData *Mesh; //the created mesh
00232   double *Points;    //the raw points in double precision
00233   void SetPoint(vtkIdType id, double *x)
00234     {vtkIdType idx=3*id; 
00235     this->Points[idx] = x[0];
00236     this->Points[idx+1] = x[1];
00237     this->Points[idx+2] = x[2];
00238     }
00239       
00240   void GetPoint(vtkIdType id, double x[3])
00241     {double *ptr = this->Points + 3*id;
00242     x[0] = *ptr++;
00243     x[1] = *ptr++;
00244     x[2] = *ptr;
00245     }
00246 
00247   int NumberOfDuplicatePoints;
00248   int NumberOfDegeneracies;
00249 
00250   int *RecoverBoundary();
00251   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00252   void FillPolygons(vtkCellArray *polys, int *triUse);
00253 
00254   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00255   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00256                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00257   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00258                  vtkIdType tri);
00259 
00260 private:
00261   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00262   void operator=(const vtkDelaunay2D&);  // Not implemented.
00263 };
00264 
00265 #endif
00266 
00267