GTS Library Reference Manual |
---|
#include <gts.h> #define GTS_VERTEX_CLASS (klass) #define GTS_VERTEX (obj) #define GTS_IS_VERTEX (obj) GtsVertexClass; GtsVertex; GtsVertexClass* gts_vertex_class (void); GtsVertex* gts_vertex_new (GtsVertexClass *klass,gdouble x,gdouble y,gdouble z);gboolean gts_vertex_is_unattached (GtsVertex *v);gboolean gts_vertex_is_boundary (GtsVertex *v, GtsSurface *surface);guint gts_vertex_is_contact (GtsVertex *v,gboolean sever); GtsSegment* gts_vertices_are_connected (GtsVertex *v1, GtsVertex *v2);void gts_vertex_replace (GtsVertex *v, GtsVertex *with);GSList * gts_vertex_neighbors (GtsVertex *v,GSList *list, GtsSurface *surface);GSList * gts_vertex_triangles (GtsVertex *v,GSList *list);GSList * gts_vertex_faces (GtsVertex *v, GtsSurface *surface,GSList *list);GSList * gts_vertex_fan_oriented (GtsVertex *v, GtsSurface *surface);gboolean gts_vertex_encroaches_edge (GtsVertex *v, GtsEdge *e);GSList * gts_vertices_from_segments (GSList *segments);GList * gts_vertices_merge (GList *vertices,gdouble epsilon,gboolean (*check) (GtsVertex *, GtsVertex *));
#define GTS_VERTEX_CLASS(klass)
Casts klass
to GtsVertexClass.
klass : | a descendant of GtsVertexClass. |
#define GTS_IS_VERTEX(obj)
Evaluates to TRUE if obj
is a descendant of GtsVertex, FALSE otherwise.
obj : | a pointer to test. |
typedef struct { GtsPointClass parent_class; void (* intersection_attributes) (GtsVertex *, GtsObject *, GtsObject *); } GtsVertexClass;
The vertex class. No virtual functions are associated.
typedef struct { GtsPoint p; GSList * segments; } GtsVertex;
The vertex object.
GtsPoint p ; | The parent object. |
segments ; | Contains all the GtsSegment using this vertex as one of their endpoints. |
GtsVertex* gts_vertex_new (GtsVertexClass *klass,gdouble x,gdouble y,gdouble z);
klass : | |
x : | the x-coordinate of the vertex to create. |
y : | the y-coordinate of the vertex to create. |
z : | the y-coordinate of the vertex to create. |
Returns : | a new GtsVertex with |
gboolean gts_vertex_is_unattached (GtsVertex *v);
v : | a GtsVertex. |
Returns : | TRUE if |
gboolean gts_vertex_is_boundary (GtsVertex *v, GtsSurface *surface);
v : | a GtsVertex. |
surface : | a GtsSurface or NULL. |
Returns : | TRUE if |
guint gts_vertex_is_contact (GtsVertex *v,gboolean sever);
v : | a GtsVertex. |
sever : | if TRUE and if |
Returns : | the number of sets of connected triangles sharing |
GtsSegment* gts_vertices_are_connected (GtsVertex *v1, GtsVertex *v2);
v1 : | a GtsVertex. |
v2 : | another GtsVertex. |
Returns : | if |
void gts_vertex_replace (GtsVertex *v, GtsVertex *with);
Replaces vertex v
with vertex with
. v
and with
must be
different. All the GtsSegment which have v
has one of their
vertices are updated. The segments list of vertex v
is freed and
v
->segments is set to NULL.
v : | a GtsVertex. |
with : | another GtsVertex. |
GSList * gts_vertex_neighbors (GtsVertex *v,GSList *list, GtsSurface *surface);
Adds to list
all the GtsVertex connected to v
by a GtsSegment and not
already in list
. If surface
is not NULL only the vertices connected to
v
by an edge belonging to surface
are considered.
v : | a GtsVertex. |
list : | a list of GtsVertex. |
surface : | a GtsSurface or NULL. |
Returns : | the new list of unique GtsVertex. |
GSList * gts_vertex_triangles (GtsVertex *v,GSList *list);
Adds all the GtsTriangle which share v
as a vertex and do not
already belong to list
.
v : | a GtsVertex. |
list : | a list of GtsTriangle. |
Returns : | the new list of unique GtsTriangle which share |
GSList * gts_vertex_faces (GtsVertex *v, GtsSurface *surface,GSList *list);
Adds all the GtsFace belonging to surface
(if not NULL) which share
v
as a vertex and do not already belong to list
.
v : | a GtsVertex. |
surface : | a GtsSurface or NULL. |
list : | a list of GtsFace. |
Returns : | the new list of unique GtsFace belonging to |
GSList * gts_vertex_fan_oriented (GtsVertex *v, GtsSurface *surface);
v : | a GtsVertex. |
surface : | a GtsSurface. |
Returns : | a list of GtsEdge describing in counterclockwise order the
boundary of the fan of summit |
gboolean gts_vertex_encroaches_edge (GtsVertex *v, GtsEdge *e);
v : | a GtsVertex. |
e : | a GtsEdge. |
Returns : | TRUE if |
GSList * gts_vertices_from_segments (GSList *segments);
segments : | a list of GtsSegment. |
Returns : | a list of GtsVertex, vertices of a GtsSegment in |
GList * gts_vertices_merge (GList *vertices,gdouble epsilon,gboolean (*check) (GtsVertex *, GtsVertex *));
For each vertex v in vertices
look if there are any vertex of
vertices
contained in a box centered on v of size 2*epsilon
. If
there are and if check
is not NULL and returns TRUE, replace
them with v (using gts_vertex_replace()
), destroy them and remove
them from list. This is done efficiently using Kd-Trees.
vertices : | a list of GtsVertex. |
epsilon : | half the size of the bounding box to consider for each vertex. |
check : | function called for each pair of vertices about to be merged or NULL. |
Returns : | the updated list of vertices. |
<<< Points | Segments >>> |