GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-835afb4352
dgraph.h
Go to the documentation of this file.
1 #ifndef GRASS_DdglGraph_s_H
2 #define GRASS_DdglGraph_s_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 below */
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(const struct line_pnts *Points);
37 
38 #endif
struct planar_graph * pg_create_struct(int n, int e)
Definition: dgraph.c:346
int pg_existsedge(struct planar_graph *pg, int v1, int v2)
Definition: dgraph.c:376
void pg_addedge(struct planar_graph *pg, int v1, int v2)
Definition: dgraph.c:410
struct planar_graph * pg_create(const struct line_pnts *Points)
Definition: dgraph.c:444
void pg_destroy_struct(struct planar_graph *pg)
Definition: dgraph.c:362
Feature geometry info - coordinates.
Definition: dig_structs.h:1651
Definition: dgraph.h:6
char winding_left
Definition: dgraph.h:11
int v1
Definition: dgraph.h:7
int v2
Definition: dgraph.h:8
char winding_right
Definition: dgraph.h:12
char visited_right
Definition: dgraph.h:10
char visited_left
Definition: dgraph.h:9
int ecount
Definition: dgraph.h:18
struct pg_edge ** edges
Definition: dgraph.h:20
double * angles
Definition: dgraph.h:21
double x
Definition: dgraph.h:16
int eallocated
Definition: dgraph.h:19
double y
Definition: dgraph.h:17
int ecount
Definition: dgraph.h:27
struct pg_edge * e
Definition: dgraph.h:29
int eallocated
Definition: dgraph.h:28
struct pg_vertex * v
Definition: dgraph.h:26
int vcount
Definition: dgraph.h:25