GTS Library Reference Manual |
---|
#include <gts.h> #define GTS_CONSTRAINT_CLASS (klass) #define GTS_CONSTRAINT (obj) #define GTS_IS_CONSTRAINT (obj) GtsConstraintClass; 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, GtsFace *guess); GtsVertex* gts_delaunay_add_vertex_to_face (GtsSurface *surface, GtsVertex *v, GtsFace *f);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);guint gts_delaunay_conform (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer data);guint gts_delaunay_refine (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer encroach_data, GtsKeyFunc cost,gpointer cost_data);
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.
The functions gts_delaunay_conform()
and gts_delaunay_refine()
can be used to build Delaunay conforming constrained triangulations and to refine them.
#define GTS_CONSTRAINT_CLASS(klass)
Casts klass
to GtsConstraintClass.
klass : | a descendant of GtsConstraintClass. |
#define GTS_CONSTRAINT(obj)
Casts obj
to GtsConstraint.
obj : | a descendant of GtsConstraint. |
#define GTS_IS_CONSTRAINT(obj)
Evaluates to TRUE if obj
is a GtsConstraint, FALSE otherwise.
obj : | a pointer to test. |
typedef struct _GtsConstraintClass GtsConstraintClass;
The constraint class derived from GtsEdgeClass.
typedef struct _GtsConstraint GtsConstraint;
The constraint object derived from GtsEdge.
GtsConstraintClass* gts_constraint_class (void);
Returns : | the GtsConstraintClass. |
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 |
Returns : | a GtsFace of |
GtsVertex* gts_delaunay_add_vertex (GtsSurface *surface, GtsVertex *v, GtsFace *guess);
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. |
guess : | NULL or a GtsFace belonging to |
Returns : | NULL is |
GtsVertex* gts_delaunay_add_vertex_to_face (GtsSurface *surface, GtsVertex *v, GtsFace *f);
Adds vertex v
to the face f
of the Delaunay triangulation defined
by surface
.
surface : | a GtsSurface. |
v : | a GtsVertex. |
f : | a GtsFace belonging to |
Returns : | NULL is |
void gts_delaunay_remove_vertex (GtsSurface *surface, GtsVertex *v);
Removes v
from the Delaunay triangulation defined by surface
and
restores 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. |
GSList * gts_delaunay_add_constraint (GtsSurface *surface, GtsConstraint *c);
Add constraint c
to the constrained Delaunay triangulation defined by
surface
.
surface : | a GtsSurface. |
c : | |
Returns : | a list of GtsConstraint conflicting (i.e. intersecting) with |
GtsFace* gts_delaunay_check (GtsSurface *surface);
surface : | a GtsSurface. |
Returns : | NULL if the planar projection of |
void gts_delaunay_remove_hull (GtsSurface *surface);
Removes all the edges of the boundary of surface
which are not
constraints.
surface : | a GtsSurface. |
guint gts_delaunay_conform (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer data);
Recursively split constraints of surface
which are encroached by
vertices of surface
(see Shewchuk 96 for details). The split
constraints are destroyed and replaced by a set of new constraints
of the same class. If gts_vertex_encroaches_edge()
is used for
encroaches
, the resulting surface will be Delaunay conforming.
If steiner_max
is positive or nul, the recursive splitting
procedure will stop when this maximum number of Steiner points is
reached. In that case the resulting surface will not necessarily be
Delaunay conforming.
surface : | a GtsSurface describing a constrained Delaunay triangulation. |
steiner_max : | maximum number of Steiner points. |
encroaches : | |
data : | user-data to pass to |
Returns : | the number of remaining encroached edges. If |
guint gts_delaunay_refine (GtsSurface *surface,gint steiner_max, GtsEncroachFunc encroaches,gpointer encroach_data, GtsKeyFunc cost,gpointer cost_data);
An implementation of the refinement algorithm described in Ruppert (1995) and Shewchuk (1996).
surface : | a GtsSurface describing a conforming Delaunay triangulation. |
steiner_max : | maximum number of Steiner points. |
encroaches : | |
encroach_data : | user-data to pass to |
cost : | a GtsKeyFunc used to sort the faces during refinement. |
cost_data : | user-data to pass to |
Returns : | the number of unrefined faces of |
<<< Isosurfaces from 3D functions | Differential geometry operators >>> |