GTS Library Reference Manual |
---|
#include <gts.h> #define GTS_SEGMENT_CLASS (klass) #define GTS_SEGMENT (obj) #define GTS_IS_SEGMENT (obj) struct GtsSegmentClass; struct GtsSegment; GtsSegmentClass* gts_segment_class (void); GtsSegment* gts_segment_new (GtsSegmentClass *klass, GtsVertex *v1, GtsVertex *v2); #define gts_segments_are_identical (s1, s2) GtsIntersect gts_segments_are_intersecting (GtsSegment *s1, GtsSegment *s2); GtsSegment* gts_segment_is_duplicate (GtsSegment *s);gboolean gts_segment_is_ok (GtsSegment *s); #define gts_segment_connect (s, e1, e2) #define gts_segments_touch (s1, s2)GSList * gts_segments_from_vertices (GSList *vertices); GtsVertex* gts_segment_midvertex (GtsSegment *s, GtsVertexClass *klass);
Segments are defined by their two GtsVertex. They are not oriented.
When destroying a GtsSegment, all the vertices not used by another edge are also destroyed. This default behaviour can be changed punctually by setting the global variable gts_allow_floating_vertices to TRUE. You must not forget to set this variable back to FALSE as all the algorithms of GTS assume the default behaviour.
#define GTS_SEGMENT_CLASS(klass)
Casts klass to GtsSegmentClass.
klass : | a descendant of GtsSegmentClass. |
#define GTS_IS_SEGMENT(obj)
Evaluates to TRUE if obj is a descendant of GtsSegment, FALSE otherwise.
obj : | a pointer to test. |
struct GtsSegmentClass { GtsObjectClass parent_class; };
The segment class. No virtual functions are assiocated.
struct GtsSegment { GtsObject object; GtsVertex * v1; GtsVertex * v2; };
The segment object.
GtsObject object | The parent object. |
GtsVertex *v1 | First endpoint of the segment. |
GtsVertex *v2 | Second endpoint of the segment. |
GtsSegment* gts_segment_new (GtsSegmentClass *klass, GtsVertex *v1, GtsVertex *v2);
klass : | |
v1 : | a GtsVertex. |
v2 : | another GtsVertex different from v1. |
Returns : | a new GtsSegment linking v1 and v2. |
#define gts_segments_are_identical(s1, s2)
Evaluates to TRUE if s1 and s2 link the same vertices, FALSE otherwise.
s1 : | a GtsSegment. |
s2 : | another GtsSegment. |
GtsIntersect gts_segments_are_intersecting (GtsSegment *s1, GtsSegment *s2);
s1 : | a GtsSegment. |
s2 : | a GtsSegment. |
Returns : | GTS_IN if s1 and s2 are intersecting, GTS_ON if one of the endpoints of s1 (resp. s2) lies on s2 (resp. s1), GTS_OUT otherwise. |
GtsSegment* gts_segment_is_duplicate (GtsSegment *s);
s : | a GtsSegment. |
Returns : | the first GtsSegment different from s which shares the same endpoints or NULL if there is none. |
gboolean gts_segment_is_ok (GtsSegment *s);
s : | a GtsSegment. |
Returns : | TRUE if s is not degenerate (i.e. s->v1 != s->v2) and not duplicate, FALSE otherwise. |
#define gts_segment_connect(s, e1, e2)
Evaluates to TRUE if s connects e1 with e2, FALSE otherwise.
s : | a GtsSegment. |
e1 : | a GtsVertex. |
e2 : | another GtsVertex. |
GSList * gts_segments_from_vertices (GSList *vertices);
vertices : | a list of GtsVertex. |
Returns : | a list of unique GtsSegment which have one of their vertices in vertices. |
GtsVertex* gts_segment_midvertex (GtsSegment *s, GtsVertexClass *klass);
s : | a GtsSegment. |
klass : | a GtsVertexClass to be used for the new vertex. |
Returns : | a new GtsVertex, midvertex of s. |
<<< Vertices | Edges >>> |