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

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 =========================================================================*/
00142 #ifndef __vtkDelaunay2D_h
00143 #define __vtkDelaunay2D_h
00144 
00145 #include "vtkPolyDataSource.h"
00146 
00147 class vtkAbstractTransform;
00148 class vtkCellArray;
00149 class vtkIdList;
00150 class vtkPointSet;
00151 
00152 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00153 {
00154 public:
00155   vtkTypeRevisionMacro(vtkDelaunay2D,vtkPolyDataSource);
00156   void PrintSelf(ostream& os, vtkIndent indent);
00157 
00160   static vtkDelaunay2D *New();
00161 
00163 
00168   void SetSource(vtkPolyData *);
00169   vtkPolyData *GetSource();
00171   
00173 
00177   vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
00178   vtkGetMacro(Alpha,double);
00180 
00182 
00185   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00186   vtkGetMacro(Tolerance,double);
00188 
00190 
00192   vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
00193   vtkGetMacro(Offset,double);
00195 
00197 
00201   vtkSetMacro(BoundingTriangulation,int);
00202   vtkGetMacro(BoundingTriangulation,int);
00203   vtkBooleanMacro(BoundingTriangulation,int);
00205 
00207 
00208   virtual void SetInput(vtkPointSet *input);
00209   vtkPointSet *GetInput();
00211 
00213 
00221   virtual void SetTransform(vtkAbstractTransform*);
00222   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00224 
00225 protected:
00226   vtkDelaunay2D();
00227   ~vtkDelaunay2D();
00228 
00229   void Execute();
00230 
00231   double Alpha;
00232   double Tolerance;
00233   int BoundingTriangulation;
00234   double Offset;
00235 
00236   vtkAbstractTransform *Transform;
00237 
00238 private:
00239   vtkPolyData *Mesh; //the created mesh
00240   double *Points;    //the raw points in double precision
00241   void SetPoint(vtkIdType id, double *x)
00242     {vtkIdType idx=3*id; 
00243     this->Points[idx] = x[0];
00244     this->Points[idx+1] = x[1];
00245     this->Points[idx+2] = x[2];
00246     }
00247       
00248   void GetPoint(vtkIdType id, double x[3])
00249     {double *ptr = this->Points + 3*id;
00250     x[0] = *ptr++;
00251     x[1] = *ptr++;
00252     x[2] = *ptr;
00253     }
00254 
00255   int NumberOfDuplicatePoints;
00256   int NumberOfDegeneracies;
00257 
00258   int *RecoverBoundary();
00259   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00260   void FillPolygons(vtkCellArray *polys, int *triUse);
00261 
00262   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00263   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00264                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00265   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00266                  vtkIdType tri);
00267 
00268   virtual int FillInputPortInformation(int, vtkInformation*);
00269 
00270 private:
00271   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00272   void operator=(const vtkDelaunay2D&);  // Not implemented.
00273 };
00274 
00275 #endif
00276 
00277