VTK
|
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 =========================================================================*/ 00127 #ifndef __vtkDelaunay2D_h 00128 #define __vtkDelaunay2D_h 00129 00130 #include "vtkPolyDataAlgorithm.h" 00131 00132 class vtkAbstractTransform; 00133 class vtkCellArray; 00134 class vtkIdList; 00135 class vtkPointSet; 00136 00137 #define VTK_DELAUNAY_XY_PLANE 0 00138 #define VTK_SET_TRANSFORM_PLANE 1 00139 #define VTK_BEST_FITTING_PLANE 2 00140 00141 class VTK_GRAPHICS_EXPORT vtkDelaunay2D : public vtkPolyDataAlgorithm 00142 { 00143 public: 00144 vtkTypeRevisionMacro(vtkDelaunay2D,vtkPolyDataAlgorithm); 00145 void PrintSelf(ostream& os, vtkIndent indent); 00146 00149 static vtkDelaunay2D *New(); 00150 00157 void SetSource(vtkPolyData *); 00158 00165 void SetSourceConnection(vtkAlgorithmOutput *algOutput); 00166 00168 vtkPolyData *GetSource(); 00169 00171 00175 vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX); 00176 vtkGetMacro(Alpha,double); 00178 00180 00183 vtkSetClampMacro(Tolerance,double,0.0,1.0); 00184 vtkGetMacro(Tolerance,double); 00186 00188 00190 vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX); 00191 vtkGetMacro(Offset,double); 00193 00195 00199 vtkSetMacro(BoundingTriangulation,int); 00200 vtkGetMacro(BoundingTriangulation,int); 00201 vtkBooleanMacro(BoundingTriangulation,int); 00203 00205 00213 virtual void SetTransform(vtkAbstractTransform*); 00214 vtkGetObjectMacro(Transform, vtkAbstractTransform); 00216 00218 00219 vtkSetClampMacro(ProjectionPlaneMode,int, 00220 VTK_DELAUNAY_XY_PLANE,VTK_BEST_FITTING_PLANE); 00221 vtkGetMacro(ProjectionPlaneMode,int); 00223 00224 protected: 00225 vtkDelaunay2D(); 00226 ~vtkDelaunay2D(); 00227 00228 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00229 00230 vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input); 00231 00232 double Alpha; 00233 double Tolerance; 00234 int BoundingTriangulation; 00235 double Offset; 00236 00237 vtkAbstractTransform *Transform; 00238 00239 int ProjectionPlaneMode; //selects the plane in 3D where the Delaunay triangulation will be computed. 00240 00241 private: 00242 vtkPolyData *Mesh; //the created mesh 00243 double *Points; //the raw points in double precision 00244 void SetPoint(vtkIdType id, double *x) 00245 {vtkIdType idx=3*id; 00246 this->Points[idx] = x[0]; 00247 this->Points[idx+1] = x[1]; 00248 this->Points[idx+2] = x[2]; 00249 } 00250 00251 void GetPoint(vtkIdType id, double x[3]) 00252 {double *ptr = this->Points + 3*id; 00253 x[0] = *ptr++; 00254 x[1] = *ptr++; 00255 x[2] = *ptr; 00256 } 00257 00258 int NumberOfDuplicatePoints; 00259 int NumberOfDegeneracies; 00260 00261 int *RecoverBoundary(vtkPolyData *source); 00262 int RecoverEdge(vtkIdType p1, vtkIdType p2); 00263 void FillPolygons(vtkCellArray *polys, int *triUse); 00264 00265 int InCircle (double x[3], double x1[3], double x2[3], double x3[3]); 00266 vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri, 00267 double tol, vtkIdType nei[3], vtkIdList *neighbors); 00268 void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2, 00269 vtkIdType tri); 00270 00271 virtual int FillInputPortInformation(int, vtkInformation*); 00272 00273 private: 00274 vtkDelaunay2D(const vtkDelaunay2D&); // Not implemented. 00275 void operator=(const vtkDelaunay2D&); // Not implemented. 00276 }; 00277 00278 #endif