VTK
vtkDelaunay2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDelaunay2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
130 #ifndef __vtkDelaunay2D_h
131 #define __vtkDelaunay2D_h
132 
133 #include "vtkPolyDataAlgorithm.h"
134 
136 class vtkCellArray;
137 class vtkIdList;
138 class vtkPointSet;
139 
140 #define VTK_DELAUNAY_XY_PLANE 0
141 #define VTK_SET_TRANSFORM_PLANE 1
142 #define VTK_BEST_FITTING_PLANE 2
143 
145 {
146 public:
148  void PrintSelf(ostream& os, vtkIndent indent);
149 
152  static vtkDelaunay2D *New();
153 
160  void SetSource(vtkPolyData *);
161 
168  void SetSourceConnection(vtkAlgorithmOutput *algOutput);
169 
171  vtkPolyData *GetSource();
172 
174 
178  vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
179  vtkGetMacro(Alpha,double);
181 
183 
186  vtkSetClampMacro(Tolerance,double,0.0,1.0);
187  vtkGetMacro(Tolerance,double);
189 
191 
193  vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
194  vtkGetMacro(Offset,double);
196 
198 
202  vtkSetMacro(BoundingTriangulation,int);
203  vtkGetMacro(BoundingTriangulation,int);
204  vtkBooleanMacro(BoundingTriangulation,int);
206 
208 
216  virtual void SetTransform(vtkAbstractTransform*);
217  vtkGetObjectMacro(Transform, vtkAbstractTransform);
219 
221 
222  vtkSetClampMacro(ProjectionPlaneMode,int,
224  vtkGetMacro(ProjectionPlaneMode,int);
226 
227 protected:
228  vtkDelaunay2D();
229  ~vtkDelaunay2D();
230 
232 
233  vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input);
234 
235  double Alpha;
236  double Tolerance;
238  double Offset;
239 
241 
242  int ProjectionPlaneMode; //selects the plane in 3D where the Delaunay triangulation will be computed.
243 
244 private:
245  vtkPolyData *Mesh; //the created mesh
246  double *Points; //the raw points in double precision
247  void SetPoint(vtkIdType id, double *x)
248  {vtkIdType idx=3*id;
249  this->Points[idx] = x[0];
250  this->Points[idx+1] = x[1];
251  this->Points[idx+2] = x[2];
252  }
253 
254  void GetPoint(vtkIdType id, double x[3])
255  {double *ptr = this->Points + 3*id;
256  x[0] = *ptr++;
257  x[1] = *ptr++;
258  x[2] = *ptr;
259  }
260 
261  int NumberOfDuplicatePoints;
262  int NumberOfDegeneracies;
263 
264  int *RecoverBoundary(vtkPolyData *source);
265  int RecoverEdge(vtkIdType p1, vtkIdType p2);
266  void FillPolygons(vtkCellArray *polys, int *triUse);
267 
268  int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
269  vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
270  double tol, vtkIdType nei[3], vtkIdList *neighbors);
271  void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
272  vtkIdType tri);
273 
274  virtual int FillInputPortInformation(int, vtkInformation*);
275 
276 private:
277  vtkDelaunay2D(const vtkDelaunay2D&); // Not implemented.
278  void operator=(const vtkDelaunay2D&); // Not implemented.
279 };
280 
281 #endif