00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00160 #ifndef __vtkDelaunay2D_h
00161 #define __vtkDelaunay2D_h
00162
00163 #include "vtkPointSet.h"
00164 #include "vtkPolyDataSource.h"
00165 #include "vtkAbstractTransform.h"
00166
00167 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataSource
00168 {
00169 public:
00170 vtkTypeMacro(vtkDelaunay2D,vtkPolyDataSource);
00171 void PrintSelf(ostream& os, vtkIndent indent);
00172
00175 static vtkDelaunay2D *New();
00176
00178
00183 void SetSource(vtkPolyData *);
00184 vtkPolyData *GetSource();
00186
00188
00192 vtkSetClampMacro(Alpha,double,0.0,VTK_LARGE_FLOAT);
00193 vtkGetMacro(Alpha,double);
00195
00197
00200 vtkSetClampMacro(Tolerance,double,0.0,1.0);
00201 vtkGetMacro(Tolerance,double);
00203
00205
00207 vtkSetClampMacro(Offset,double,0.75,VTK_LARGE_FLOAT);
00208 vtkGetMacro(Offset,double);
00210
00212
00216 vtkSetMacro(BoundingTriangulation,int);
00217 vtkGetMacro(BoundingTriangulation,int);
00218 vtkBooleanMacro(BoundingTriangulation,int);
00220
00222
00223 virtual void SetInput(vtkPointSet *input);
00224 vtkPointSet *GetInput();
00226
00228
00236 vtkSetObjectMacro(Transform, vtkAbstractTransform);
00237 vtkGetObjectMacro(Transform, vtkAbstractTransform);
00239
00240 protected:
00241 vtkDelaunay2D();
00242 ~vtkDelaunay2D();
00243
00244 void Execute();
00245
00246 double Alpha;
00247 double Tolerance;
00248 int BoundingTriangulation;
00249 double Offset;
00250
00251 vtkAbstractTransform *Transform;
00252
00253 private:
00254 vtkPolyData *Mesh;
00255 double *Points;
00256 void SetPoint(vtkIdType id, double *x)
00257 {vtkIdType idx=3*id;
00258 this->Points[idx] = x[0];
00259 this->Points[idx+1] = x[1];
00260 this->Points[idx+2] = x[2];
00261 }
00262
00263 void GetPoint(vtkIdType id, double x[3])
00264 {double *ptr = this->Points + 3*id;
00265 x[0] = *ptr++;
00266 x[1] = *ptr++;
00267 x[2] = *ptr;
00268 }
00269
00270 int NumberOfDuplicatePoints;
00271 int NumberOfDegeneracies;
00272
00273 int *RecoverBoundary();
00274 int RecoverEdge(vtkIdType p1, vtkIdType p2);
00275 void FillPolygons(vtkCellArray *polys, int *triUse);
00276
00277 int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00278 vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00279 double tol, vtkIdType nei[3], vtkIdList *neighbors);
00280 void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00281 vtkIdType tri);
00282
00283 private:
00284 vtkDelaunay2D(const vtkDelaunay2D&);
00285 void operator=(const vtkDelaunay2D&);
00286 };
00287
00288 #endif
00289
00290