00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00130 #ifndef __vtkDelaunay2D_h
00131 #define __vtkDelaunay2D_h
00132
00133 #include "vtkPolyDataAlgorithm.h"
00134
00135 class vtkAbstractTransform;
00136 class vtkCellArray;
00137 class vtkIdList;
00138 class vtkPointSet;
00139
00140 #define VTK_DELAUNAY_XY_PLANE 0
00141 #define VTK_SET_TRANSFORM_PLANE 1
00142 #define VTK_BEST_FITTING_PLANE 2
00143
00144 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataAlgorithm
00145 {
00146 public:
00147 vtkTypeMacro(vtkDelaunay2D,vtkPolyDataAlgorithm);
00148 void PrintSelf(ostream& os, vtkIndent indent);
00149
00152 static vtkDelaunay2D *New();
00153
00160 void SetSource(vtkPolyData *);
00161
00168 void SetSourceConnection(vtkAlgorithmOutput *algOutput);
00169
00171 vtkPolyData *GetSource();
00172
00174
00178 vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
00179 vtkGetMacro(Alpha,double);
00181
00183
00186 vtkSetClampMacro(Tolerance,double,0.0,1.0);
00187 vtkGetMacro(Tolerance,double);
00189
00191
00193 vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
00194 vtkGetMacro(Offset,double);
00196
00198
00202 vtkSetMacro(BoundingTriangulation,int);
00203 vtkGetMacro(BoundingTriangulation,int);
00204 vtkBooleanMacro(BoundingTriangulation,int);
00206
00208
00216 virtual void SetTransform(vtkAbstractTransform*);
00217 vtkGetObjectMacro(Transform, vtkAbstractTransform);
00219
00221
00222 vtkSetClampMacro(ProjectionPlaneMode,int,
00223 VTK_DELAUNAY_XY_PLANE,VTK_BEST_FITTING_PLANE);
00224 vtkGetMacro(ProjectionPlaneMode,int);
00226
00227 protected:
00228 vtkDelaunay2D();
00229 ~vtkDelaunay2D();
00230
00231 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00232
00233 vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input);
00234
00235 double Alpha;
00236 double Tolerance;
00237 int BoundingTriangulation;
00238 double Offset;
00239
00240 vtkAbstractTransform *Transform;
00241
00242 int ProjectionPlaneMode;
00243
00244 private:
00245 vtkPolyData *Mesh;
00246 double *Points;
00247 void SetPoint(vtkIdType id, double *x)
00248 {vtkIdType idx=3*id;
00249 this->Points[idx] = x[0];
00250 this->Points[idx+1] = x[1];
00251 this->Points[idx+2] = x[2];
00252 }
00253
00254 void GetPoint(vtkIdType id, double x[3])
00255 {double *ptr = this->Points + 3*id;
00256 x[0] = *ptr++;
00257 x[1] = *ptr++;
00258 x[2] = *ptr;
00259 }
00260
00261 int NumberOfDuplicatePoints;
00262 int NumberOfDegeneracies;
00263
00264 int *RecoverBoundary(vtkPolyData *source);
00265 int RecoverEdge(vtkIdType p1, vtkIdType p2);
00266 void FillPolygons(vtkCellArray *polys, int *triUse);
00267
00268 int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00269 vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00270 double tol, vtkIdType nei[3], vtkIdList *neighbors);
00271 void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00272 vtkIdType tri);
00273
00274 virtual int FillInputPortInformation(int, vtkInformation*);
00275
00276 private:
00277 vtkDelaunay2D(const vtkDelaunay2D&);
00278 void operator=(const vtkDelaunay2D&);
00279 };
00280
00281 #endif