VTK  9.7.0
vtkDelaunay2D.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
117
118#ifndef vtkDelaunay2D_h
119#define vtkDelaunay2D_h
120
121#include "vtkAbstractTransform.h" // For point transformation
122#include "vtkFiltersCoreModule.h" // For export macro
123#include "vtkPolyDataAlgorithm.h"
124#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
125
126VTK_ABI_NAMESPACE_BEGIN
127class vtkCellArray;
128class vtkPointSet;
129
130#define VTK_DELAUNAY_XY_PLANE 0
131#define VTK_SET_TRANSFORM_PLANE 1
132#define VTK_BEST_FITTING_PLANE 2
133
134class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkDelaunay2D : public vtkPolyDataAlgorithm
135{
136public:
138 void PrintSelf(ostream& os, vtkIndent indent) override;
139
145
156
166
171
173
179 vtkSetClampMacro(Alpha, double, 0.0, VTK_DOUBLE_MAX);
180 vtkGetMacro(Alpha, double);
182
184
189 vtkSetClampMacro(Tolerance, double, 0.0, 1.0);
190 vtkGetMacro(Tolerance, double);
192
194
198 vtkSetClampMacro(Offset, double, 0.75, VTK_DOUBLE_MAX);
199 vtkGetMacro(Offset, double);
201
203
213
215
225 vtkSetSmartPointerMacro(Transform, vtkAbstractTransform);
226 vtkGetSmartPointerMacro(Transform, vtkAbstractTransform);
228
230
239 vtkGetMacro(ProjectionPlaneMode, int);
241
249
251
260
262
273 vtkBooleanMacro(UseHilbertSorter, vtkTypeBool);
275
276protected:
278
280
281 double Alpha;
282 double Tolerance;
284 double Offset;
287
288 // Transform input points (if necessary)
290
291 int ProjectionPlaneMode; // selects the plane in 3D where the Delaunay triangulation will be
292 // computed.
293
294private:
295 vtkSmartPointer<vtkPolyData> Mesh; // the created mesh
296
297 // the raw points in double precision, and methods to access them
298 double* Points;
299 void SetPoint(vtkIdType id, double* x)
300 {
301 vtkIdType idx = 3 * id;
302 this->Points[idx] = x[0];
303 this->Points[idx + 1] = x[1];
304 this->Points[idx + 2] = x[2];
305 }
306 void GetPoint(vtkIdType id, double x[3])
307 {
308 double* ptr = this->Points + 3 * id;
309 x[0] = *ptr++;
310 x[1] = *ptr++;
311 x[2] = *ptr;
312 }
313
314 // Keep track of the bounding radius of all points (including the eight bounding points).
315 // This is used occasionally for numerical sanity checks to determine whether a point is
316 // within a circumcircle.
317 double BoundingRadius2;
318
319 int NumberOfDuplicatePoints;
320 int NumberOfDegeneracies;
321
322 // Various methods to support the Delaunay algorithm
323 int* RecoverBoundary(vtkPolyData* source);
324 int RecoverEdge(vtkPolyData* source, vtkIdType p1, vtkIdType p2);
325 void FillPolygons(vtkCellArray* polys, int* triUse);
326
327 int InCircle(double x[3], double x1[3], double x2[3], double x3[3]);
328
329 // CheckEdge() determines if the edge (p1,p2) of triangle tri satisfies the
330 // Delaunay criterion; if not it swaps the edge diagonal.
331 bool CheckEdge(vtkIdType ptId, double x[3], vtkIdType p1, vtkIdType p2, vtkIdType tri);
332
333 int FillInputPortInformation(int, vtkInformation*) override;
334
335 vtkDelaunay2D(const vtkDelaunay2D&) = delete;
336 void operator=(const vtkDelaunay2D&) = delete;
337};
338
339VTK_ABI_NAMESPACE_END
340#endif
void GetPoint(int i, int j, int k, double pnt[3])
superclass for all geometric transformations
Proxy object to connect input/output ports.
object to represent cell connectivity
vtkPolyData * GetSource()
Get a pointer to the source object.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
static vtkDelaunay2D * New()
Construct object with Alpha = 0.0; Tolerance = 0.001; Offset = 1.25; BoundingTriangulation turned off...
vtkTypeBool UseHilbertSorter
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the source object used to specify constrained edges and loops.
vtkSmartPointer< vtkAbstractTransform > Transform
static vtkAbstractTransform * ComputeBestFittingPlane(vtkPointSet *input)
This method computes the best fit plane to a set of points represented by a vtkPointSet.
vtkTypeBool BoundingTriangulation
vtkTypeBool RandomPointInsertion
void SetSourceData(vtkPolyData *)
Specify the source object used to specify constrained edges and loops.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition vtkPointSet.h:59
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
Hold a reference to a vtkObjectBase instance.
int vtkTypeBool
Definition vtkABI.h:64
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_BEST_FITTING_PLANE
#define VTK_DELAUNAY_XY_PLANE
int vtkIdType
Definition vtkType.h:363
#define VTK_DOUBLE_MAX
Definition vtkType.h:202
#define VTK_MARSHALAUTO