VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Core/vtkDelaunay2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDelaunay2D.h
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 =========================================================================*/
00130 #ifndef vtkDelaunay2D_h
00131 #define vtkDelaunay2D_h
00132 
00133 #include "vtkFiltersCoreModule.h" // For export macro
00134 #include "vtkPolyDataAlgorithm.h"
00135 
00136 class vtkAbstractTransform;
00137 class vtkCellArray;
00138 class vtkIdList;
00139 class vtkPointSet;
00140 
00141 #define VTK_DELAUNAY_XY_PLANE 0
00142 #define VTK_SET_TRANSFORM_PLANE 1
00143 #define VTK_BEST_FITTING_PLANE 2
00144 
00145 class VTKFILTERSCORE_EXPORT vtkDelaunay2D : public vtkPolyDataAlgorithm
00146 {
00147 public:
00148   vtkTypeMacro(vtkDelaunay2D,vtkPolyDataAlgorithm);
00149   void PrintSelf(ostream& os, vtkIndent indent);
00150 
00153   static vtkDelaunay2D *New();
00154 
00162   void SetSourceData(vtkPolyData *);
00163 
00170   void SetSourceConnection(vtkAlgorithmOutput *algOutput);
00171 
00173   vtkPolyData *GetSource();
00174 
00176 
00180   vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
00181   vtkGetMacro(Alpha,double);
00183 
00185 
00188   vtkSetClampMacro(Tolerance,double,0.0,1.0);
00189   vtkGetMacro(Tolerance,double);
00191 
00193 
00195   vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
00196   vtkGetMacro(Offset,double);
00198 
00200 
00204   vtkSetMacro(BoundingTriangulation,int);
00205   vtkGetMacro(BoundingTriangulation,int);
00206   vtkBooleanMacro(BoundingTriangulation,int);
00208 
00210 
00218   virtual void SetTransform(vtkAbstractTransform*);
00219   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00221 
00223 
00224   vtkSetClampMacro(ProjectionPlaneMode,int,
00225                    VTK_DELAUNAY_XY_PLANE,VTK_BEST_FITTING_PLANE);
00226   vtkGetMacro(ProjectionPlaneMode,int);
00228 
00229 protected:
00230   vtkDelaunay2D();
00231   ~vtkDelaunay2D();
00232 
00233   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00234 
00235   vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input);
00236 
00237   double Alpha;
00238   double Tolerance;
00239   int BoundingTriangulation;
00240   double Offset;
00241 
00242   vtkAbstractTransform *Transform;
00243 
00244   int ProjectionPlaneMode; //selects the plane in 3D where the Delaunay triangulation will be computed.
00245 
00246 private:
00247   vtkPolyData *Mesh; //the created mesh
00248   double *Points;    //the raw points in double precision
00249   void SetPoint(vtkIdType id, double *x)
00250     {vtkIdType idx=3*id;
00251     this->Points[idx] = x[0];
00252     this->Points[idx+1] = x[1];
00253     this->Points[idx+2] = x[2];
00254     }
00255 
00256   void GetPoint(vtkIdType id, double x[3])
00257     {double *ptr = this->Points + 3*id;
00258     x[0] = *ptr++;
00259     x[1] = *ptr++;
00260     x[2] = *ptr;
00261     }
00262 
00263   int NumberOfDuplicatePoints;
00264   int NumberOfDegeneracies;
00265 
00266   int *RecoverBoundary(vtkPolyData *source);
00267   int RecoverEdge(vtkIdType p1, vtkIdType p2);
00268   void FillPolygons(vtkCellArray *polys, int *triUse);
00269 
00270   int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
00271   vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
00272                          double tol, vtkIdType nei[3], vtkIdList *neighbors);
00273   void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
00274                  vtkIdType tri, bool recursive);
00275 
00276   virtual int FillInputPortInformation(int, vtkInformation*);
00277 
00278 private:
00279   vtkDelaunay2D(const vtkDelaunay2D&);  // Not implemented.
00280   void operator=(const vtkDelaunay2D&);  // Not implemented.
00281 };
00282 
00283 #endif