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 "vtkFiltersCoreModule.h" // For export macro
134 #include "vtkPolyDataAlgorithm.h"
135 
137 class vtkCellArray;
138 class vtkIdList;
139 class vtkPointSet;
140 
141 #define VTK_DELAUNAY_XY_PLANE 0
142 #define VTK_SET_TRANSFORM_PLANE 1
143 #define VTK_BEST_FITTING_PLANE 2
144 
146 {
147 public:
149  void PrintSelf(ostream& os, vtkIndent indent);
150 
153  static vtkDelaunay2D *New();
154 
161  void SetSourceData(vtkPolyData *);
162 
169  void SetSourceConnection(vtkAlgorithmOutput *algOutput);
170 
172  vtkPolyData *GetSource();
173 
175 
179  vtkSetClampMacro(Alpha,double,0.0,VTK_DOUBLE_MAX);
180  vtkGetMacro(Alpha,double);
182 
184 
187  vtkSetClampMacro(Tolerance,double,0.0,1.0);
188  vtkGetMacro(Tolerance,double);
190 
192 
194  vtkSetClampMacro(Offset,double,0.75,VTK_DOUBLE_MAX);
195  vtkGetMacro(Offset,double);
197 
199 
203  vtkSetMacro(BoundingTriangulation,int);
204  vtkGetMacro(BoundingTriangulation,int);
205  vtkBooleanMacro(BoundingTriangulation,int);
207 
209 
217  virtual void SetTransform(vtkAbstractTransform*);
220 
222 
223  vtkSetClampMacro(ProjectionPlaneMode,int,
225  vtkGetMacro(ProjectionPlaneMode,int);
227 
228 protected:
229  vtkDelaunay2D();
230  ~vtkDelaunay2D();
231 
233 
234  vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input);
235 
236  double Alpha;
237  double Tolerance;
239  double Offset;
240 
242 
243  int ProjectionPlaneMode; //selects the plane in 3D where the Delaunay triangulation will be computed.
244 
245 private:
246  vtkPolyData *Mesh; //the created mesh
247  double *Points; //the raw points in double precision
248  void SetPoint(vtkIdType id, double *x)
249  {vtkIdType idx=3*id;
250  this->Points[idx] = x[0];
251  this->Points[idx+1] = x[1];
252  this->Points[idx+2] = x[2];
253  }
254 
255  void GetPoint(vtkIdType id, double x[3])
256  {double *ptr = this->Points + 3*id;
257  x[0] = *ptr++;
258  x[1] = *ptr++;
259  x[2] = *ptr;
260  }
261 
262  int NumberOfDuplicatePoints;
263  int NumberOfDegeneracies;
264 
265  int *RecoverBoundary(vtkPolyData *source);
266  int RecoverEdge(vtkIdType p1, vtkIdType p2);
267  void FillPolygons(vtkCellArray *polys, int *triUse);
268 
269  int InCircle (double x[3], double x1[3], double x2[3], double x3[3]);
270  vtkIdType FindTriangle(double x[3], vtkIdType ptIds[3], vtkIdType tri,
271  double tol, vtkIdType nei[3], vtkIdList *neighbors);
272  void CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2,
273  vtkIdType tri);
274 
275  virtual int FillInputPortInformation(int, vtkInformation*);
276 
277 private:
278  vtkDelaunay2D(const vtkDelaunay2D&); // Not implemented.
279  void operator=(const vtkDelaunay2D&); // Not implemented.
280 };
281 
282 #endif
virtual int FillInputPortInformation(int port, vtkInformation *info)
#define VTK_DOUBLE_MAX
Definition: vtkType.h:141
Store vtkAlgorithm input/output information.
GLenum GLenum GLenum input
Definition: vtkgl.h:15941
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTKFILTERSCORE_EXPORT
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:41
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
int vtkIdType
Definition: vtkType.h:268
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
Proxy object to connect input/output ports.
static vtkPolyDataAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
superclass for all geometric transformations
vtkAbstractTransform * Transform
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
#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:49
create 2D Delaunay triangulation of input points
Store zero or more vtkInformation instances.
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
GLuint id
Definition: vtkgl.h:11834
#define VTK_DELAUNAY_XY_PLANE
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
int BoundingTriangulation