Delaunay and constrained Delaunay triangulations

Name

Delaunay and constrained Delaunay triangulations -- implementation of a dynamic Delaunay triangulation algorithm.

Synopsis


#include <gts.h>


#define     GTS_CONSTRAINT_CLASS            (klass)
#define     GTS_CONSTRAINT                  (obj)
#define     GTS_IS_CONSTRAINT               (obj)
struct      GtsConstraintClass;
struct      GtsConstraint;
GtsConstraintClass* gts_constraint_class    (void);
GtsFace*    gts_point_locate                (GtsPoint *p,
                                             GtsSurface *surface,
                                             GtsFace *guess);
GtsVertex*  gts_delaunay_add_vertex         (GtsSurface *surface,
                                             GtsVertex *v);
void        gts_delaunay_remove_vertex      (GtsSurface *surface,
                                             GtsVertex *v);
GSList*     gts_delaunay_add_constraint     (GtsSurface *surface,
                                             GtsConstraint *c);
GtsFace*    gts_delaunay_check              (GtsSurface *surface);
void        gts_delaunay_remove_hull        (GtsSurface *surface);

Description

The functions described in this section are useful to build two-dimensional Delaunay and constrained Delaunay triangulations. Only the x and y coordinates of the points are taken into account.

The algorithm is fully dynamic (insertion and deletion) for Delaunay triangulation and semi-dynamic (insertion only of vertices and constraints) for constrained Delaunay triangulation.

The insertion part uses a very simple jump-and-walk location algorithm which can be used on any (even non-Delaunay) 2D triangulation as long as its boundary is convex.

Details

GTS_CONSTRAINT_CLASS()

#define     GTS_CONSTRAINT_CLASS(klass)

Casts klass to GtsConstraintClass.

klass :a descendant of GtsConstraintClass.


GTS_CONSTRAINT()

#define     GTS_CONSTRAINT(obj)

Casts obj to GtsConstraint.

obj :a descendant of GtsConstraint.


GTS_IS_CONSTRAINT()

#define     GTS_IS_CONSTRAINT(obj)

Evaluates to TRUE if obj is a GtsConstraint, FALSE otherwise.

obj :a pointer to test.


struct GtsConstraintClass

struct GtsConstraintClass;

The constraint class derived from GtsEdgeClass.


struct GtsConstraint

struct GtsConstraint;

The constraint object derived from GtsEdge.


gts_constraint_class ()

GtsConstraintClass* gts_constraint_class    (void);

Returns : the GtsConstraintClass.


gts_point_locate ()

GtsFace*    gts_point_locate                (GtsPoint *p,
                                             GtsSurface *surface,
                                             GtsFace *guess);

Locates the face of the planar projection of surface containing p. The planar projection of surface must define a connected set of triangles without holes and bounded by a convex boundary. The algorithm is randomized and performs in O(n^1/3) expected time where n is the number of triangles of surface.

If a good guess is given the point location can be significantly faster.

p : a GtsPoint.
surface : a GtsSurface.
guess : NULL or a face of surface close to p.
Returns : a GtsFace of surface containing p or NULL if p is not contained within the boundary of surface.


gts_delaunay_add_vertex ()

GtsVertex*  gts_delaunay_add_vertex         (GtsSurface *surface,
                                             GtsVertex *v);

Adds vertex v to the Delaunay triangulation defined by surface. If v is not contained in the convex hull bounding surface, v is not added to the triangulation.

surface : a GtsSurface.
v : a GtsVertex.
Returns : NULL is v has been successfully added to surface or was already contained in surface, v if v is not contained in the convex hull bounding surface or a GtsVertex having the same x and y coordinates as v.


gts_delaunay_remove_vertex ()

void        gts_delaunay_remove_vertex      (GtsSurface *surface,
                                             GtsVertex *v);

Removes v from the Delaunay triangulation defined by surface and restore the Delaunay property. Vertex v must not be used by any constrained edge otherwise the triangulation is not guaranteed to be Delaunay.

surface : a GtsSurface.
v : a GtsVertex.


gts_delaunay_add_constraint ()

GSList*     gts_delaunay_add_constraint     (GtsSurface *surface,
                                             GtsConstraint *c);

Add constraint c to the constrained Delaunay triangulation defined by surface.

surface : a GtsSurface.
c : a GtsConstraint.
Returns : a list of GtsConstraint conflicting (i.e. intersecting) with c which were removed from surface.


gts_delaunay_check ()

GtsFace*    gts_delaunay_check              (GtsSurface *surface);

surface : a GtsSurface.
Returns : NULL if the planar projection of surface is a Delaunay triangulation (unconstrained), a GtsFace violating the Delaunay property otherwise.


gts_delaunay_remove_hull ()

void        gts_delaunay_remove_hull        (GtsSurface *surface);

Removes all the edges of the boundary of surface which are not constraints.

surface : a GtsSurface.