GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
dgraph.h
Go to the documentation of this file.
1 #ifndef GRASS_DGRAPH_H
2 #define GRASS_DGRAPH_H
3 
4 /* pg comes from "planar graph" */
5 /* every edge is directed. Nevertheless, we can visit it on both sides */
6 struct pg_edge {
7  int v1; /* first vertex */
8  int v2; /* second vertex */
11  char winding_left; /* winding numbers */
13 };
14 
15 struct pg_vertex {
16  double x; /* coordinates */
17  double y;
18  int ecount; /* number of neighbours */
19  int eallocated; /* size of the array bellow */
20  struct pg_edge **edges; /* array of pointers */
21  double *angles; /* precalculated angles with Ox */
22 };
23 
24 struct planar_graph {
25  int vcount; /* number of vertices */
26  struct pg_vertex *v;
27  int ecount;
29  struct pg_edge *e;
30 };
31 
32 struct planar_graph* pg_create_struct(int n, int e);
33 void pg_destroy_struct(struct planar_graph *pg);
34 int pg_existsedge(struct planar_graph *pg, int v1, int v2);
35 void pg_addedge(struct planar_graph *pg, int v1, int v2);
36 struct planar_graph* pg_create(struct line_pnts *Points);
37 
38 #endif