GRASS Programmer's Manual 6.4.1(2011)
|
00001 #ifndef GRASS_DGRAPH_H 00002 #define GRASS_DGRAPH_H 00003 00004 /* pg comes from "planar graph" */ 00005 /* every edge is directed. Nevertheless, we can visit it on both sides */ 00006 struct pg_edge { 00007 int v1; /* first vertex */ 00008 int v2; /* second vertex */ 00009 char visited_left; 00010 char visited_right; 00011 char winding_left; /* winding numbers */ 00012 char winding_right; 00013 }; 00014 00015 struct pg_vertex { 00016 double x; /* coordinates */ 00017 double y; 00018 int ecount; /* number of neighbours */ 00019 int eallocated; /* size of the array bellow */ 00020 struct pg_edge **edges; /* array of pointers */ 00021 double *angles; /* precalculated angles with Ox */ 00022 }; 00023 00024 struct planar_graph { 00025 int vcount; /* number of vertices */ 00026 struct pg_vertex *v; 00027 int ecount; 00028 int eallocated; 00029 struct pg_edge *e; 00030 }; 00031 00032 struct planar_graph* pg_create_struct(int n, int e); 00033 void pg_destroy_struct(struct planar_graph *pg); 00034 int pg_existsedge(struct planar_graph *pg, int v1, int v2); 00035 void pg_addedge(struct planar_graph *pg, int v1, int v2); 00036 struct planar_graph* pg_create(struct line_pnts *Points); 00037 00038 #endif