GTS Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# Vertices

## Name

Vertices -- vertex object and related functions.

## Synopsis

    #include <gts.h>

    #define     GTS_VERTEX_CLASS                (klass)
    #define     GTS_VERTEX                      (obj)
    #define     GTS_IS_VERTEX                   (obj)
    struct      GtsVertexClass;
    struct      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);

## Description

Vertices are points used as endpoints of GtsSegment. They are derived from GtsPoint.

## Details

### GTS_VERTEX_CLASS()

    #define     GTS_VERTEX_CLASS(klass)

Casts `klass` to GtsVertexClass.

`klass` : | a descendant of GtsVertexClass.

### GTS_VERTEX()

    #define     GTS_VERTEX(obj)

Casts `obj` to GtsVertex.

`obj` : | a descendant of GtsVertex.

### GTS_IS_VERTEX()

    #define     GTS_IS_VERTEX(obj)

Evaluates to `TRUE` if `obj` is a descendant of GtsVertex, `FALSE` otherwise.

`obj` : | a pointer to test.

### struct GtsVertexClass

    struct GtsVertexClass;

The vertex class. No virtual functions are associated.

### struct GtsVertex

    struct GtsVertex {
      GtsPoint p;

      GSList * segments;
    };

The vertex object.

GtsPoint `p` | The parent object.
GSList *`segments` | Contains all the GtsSegment using this vertex as one of their endpoints.

### gts_vertex_class ()

    GtsVertexClass* gts_vertex_class            (void);

Returns : | the GtsVertexClass.

### gts_vertex_new ()

    GtsVertex*  gts_vertex_new                  (GtsVertexClass *klass,
                                                 gdouble x,
                                                 gdouble y,
                                                 gdouble z);

`klass` : | a GtsVertexClass.
`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 `x`, `y` and `z` as coordinates.

### gts_vertex_is_unattached ()

    gboolean    gts_vertex_is_unattached        (GtsVertex *v);

`v` : | a GtsVertex.
Returns : | `TRUE` if `v` is not the endpoint of any GtsSegment, `FALSE` otherwise.

### gts_vertex_is_boundary ()

    gboolean    gts_vertex_is_boundary          (GtsVertex *v,
                                                 GtsSurface *surface);

`v` : | a GtsVertex.
`surface` : | a GtsSurface or `NULL`.
Returns : | `TRUE` if `v` is used by a GtsEdge boundary of `surface` as determined by gts_edge_is_boundary(), `FALSE` otherwise.

### gts_vertex_is_contact ()

    guint       gts_vertex_is_contact           (GtsVertex *v,
                                                 gboolean sever);

`v` : | a GtsVertex.
`sever` : | if `TRUE` and if `v` is a contact vertex between two or more sets of connected triangles replaces it with as many vertices, clones of `v`.
Returns : | the number of sets of connected triangles sharing `v` as a contact vertex.

### gts_vertices_are_connected ()

    GtsSegment* gts_vertices_are_connected      (GtsVertex *v1,
                                                 GtsVertex *v2);

`v1` : | a GtsVertex.
`v2` : | another GtsVertex.
Returns : | if `v1` and `v2` are the vertices of the same GtsSegment this segment else `NULL`.

### gts_vertex_replace ()

    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.

### gts_vertex_neighbors ()

    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.

### gts_vertex_triangles ()

    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 `v` as a vertex.

### gts_vertex_faces ()

    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 `surface` which share `v` as a vertex.

### gts_vertex_fan_oriented ()

    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 `v`, the faces of the fan belonging to `surface`.

### gts_vertex_encroaches_edge ()

    gboolean    gts_vertex_encroaches_edge      (GtsVertex *v,
                                                 GtsEdge *e);

`v` : | a GtsVertex.
`e` : | a GtsEdge.
Returns : | `TRUE` if `v` is strictly contained in the diametral circle of `e`, `FALSE` otherwise.

### gts_vertices_from_segments ()

    GSList*     gts_vertices_from_segments      (GSList *segments);

`segments` : | a list of GtsSegment.
Returns : | a list of GtsVertex, vertices of a GtsSegment in `segments`. Each element in the list is unique (no duplicates).

### gts_vertices_merge ()

    GList*      gts_vertices_merge              (GList *vertices,
                                                 gdouble epsilon);

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, 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.
Returns : | the updated list of vertices.

<<< Previous Page | Home | Up | Next Page >>>
Points | Segments