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 =========================================================================*/
125 #ifndef vtkDelaunay2D_h
126 #define vtkDelaunay2D_h
127 
128 #include "vtkFiltersCoreModule.h" // For export macro
129 #include "vtkPolyDataAlgorithm.h"
130 
132 class vtkCellArray;
133 class vtkIdList;
134 class vtkPointSet;
135 
136 #define VTK_DELAUNAY_XY_PLANE 0
137 #define VTK_SET_TRANSFORM_PLANE 1
138 #define VTK_BEST_FITTING_PLANE 2
139 
140 class VTKFILTERSCORE_EXPORT vtkDelaunay2D : public vtkPolyDataAlgorithm
141 {
142 public:
144  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
145 
150  static vtkDelaunay2D *New();
151 
161  void SetSourceData(vtkPolyData *);
162 
171  void SetSourceConnection(vtkAlgorithmOutput *algOutput);
172 
176  vtkPolyData *GetSource();
177 
179 
185  vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
186  vtkGetMacro(Alpha,double);
188 
190 
195  vtkSetClampMacro(Tolerance,double,0.0,1.0);
196  vtkGetMacro(Tolerance,double);
198 
200 
204  vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
205  vtkGetMacro(Offset,double);
207 
209 
215  vtkSetMacro(BoundingTriangulation,int);
216  vtkGetMacro(BoundingTriangulation,int);
217  vtkBooleanMacro(BoundingTriangulation,int);
219 
221 
231  virtual void SetTransform(vtkAbstractTransform*);
232  vtkGetObjectMacro(Transform, vtkAbstractTransform);
234 
236 
239  vtkSetClampMacro(ProjectionPlaneMode,int,
241  vtkGetMacro(ProjectionPlaneMode,int);
243 
244 protected:
245  vtkDelaunay2D();
246  ~vtkDelaunay2D() VTK_OVERRIDE;
247 
248  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
249 
250  vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input);
251 
252  double Alpha;
253  double Tolerance;
254  int BoundingTriangulation;
255  double Offset;
256 
258 
259  int ProjectionPlaneMode; //selects the plane in 3D where the Delaunay triangulation will be computed.
260 
261 private:
262  vtkPolyData *Mesh; //the created mesh
263  double *Points; //the raw points in double precision
264  void SetPoint(vtkIdType id, double *x)
265  {vtkIdType idx=3*id;
266  this->Points[idx] = x[0];
267  this->Points[idx+1] = x[1];
268  this->Points[idx+2] = x[2];
269  }
270 
271  void GetPoint(vtkIdType id, double x[3])
272  {double *ptr = this->Points + 3*id;
273  x[0] = *ptr++;
274  x[1] = *ptr++;
275  x[2] = *ptr;
276  }
277 
278  int NumberOfDuplicatePoints;
279  int NumberOfDegeneracies;
280 
281  int *RecoverBoundary(vtkPolyData *source);
282  int RecoverEdge(vtkPolyData* source, vtkIdType p1, vtkIdType p2);
283  void FillPolygons(vtkCellArray *polys, int *triUse);
284 
285  int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
286  vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
287  double tol, vtkIdType nei[3], vtkIdList *neighbors);
288  void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
289  vtkIdType tri, bool recursive);
290 
291  int FillInputPortInformation(int, vtkInformation*) VTK_OVERRIDE;
292 
293 private:
294  vtkDelaunay2D(const vtkDelaunay2D&) VTK_DELETE_FUNCTION;
295  void operator=(const vtkDelaunay2D&) VTK_DELETE_FUNCTION;
296 };
297 
298 #endif
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
Store vtkAlgorithm input/output information.
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:39
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void GetPoint(const int i, const int j, const int k, double pnt[3])
Proxy object to connect input/output ports.
static vtkPolyDataAlgorithm * New()
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
superclass for all geometric transformations
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_BEST_FITTING_PLANE
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
object to represent cell connectivity
Definition: vtkCellArray.h:44
create 2D Delaunay triangulation of input points
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_DELAUNAY_XY_PLANE
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Transform
Definition: ADIOSDefs.h:39