Geoinformatica  0.90
vector.h
Go to the documentation of this file.
1 #ifndef RAL_VECTOR_H
2 #define RAL_VECTOR_H
3 
9 typedef struct {
10  double x;
11  double y;
12  double z;
13  double m;
14 } ral_point;
15 
16 int RAL_CALL ral_ccw(ral_point p0, ral_point p1, ral_point p2);
17 
19 typedef struct {
20  ral_point begin;
21  ral_point end;
22 } ral_line;
23 
24 int RAL_CALL ral_intersect(ral_line l1, ral_line l2);
25 
27 typedef struct {
33 
34 #define RAL_POINT_IN_RECTANGLE(p,r) \
35 (((p).x >= (r).min.x) AND ((p).x <= (r).max.x) AND \
36  ((p).y >= (r).min.y) AND ((p).y <= (r).max.y))
37 
38 #define RAL_RECTANGLES_OVERLAP(r1, r2) \
39 (!((r1.max.x < r2.min.x) OR \
40  (r1.min.y > r2.max.y) OR \
41  (r1.min.x > r2.max.x) OR \
42  (r1.max.y < r2.min.y)))
43 
44 int RAL_CALL ral_clip_line_to_rect(ral_line *l, ral_rectangle r);
45 
47 typedef struct {
51  int n;
52 } ral_polygon;
53 
54 int RAL_CALL ral_polygon_init(ral_polygon p, int n);
55 void RAL_CALL ral_polygon_finish(ral_polygon p);
56 
57 int RAL_CALL ral_insideconvex(ral_point p, ral_polygon P);
58 
59 int RAL_CALL ral_pnpoly(ral_point p, ral_polygon P);
60 
61 #define RAL_CONVEX 1
62 #define RAL_CONCAVE -1
63 
64 int RAL_CALL ral_convex(ral_polygon p);
65 double RAL_CALL ral_polygon_area(ral_polygon p);
66 
68 typedef struct {
69  ral_polygon *p;
70  int aet_begin;
71  int scanline_at;
73  int *nodes;
81 
83 
84 void RAL_CALL ral_active_edge_tables_destroy(ral_active_edge_table **aet, int n);
85 
91 
93 int RAL_CALL ral_scanline_at(ral_active_edge_table *aet_list, int n, double y, double **x, int *nx);
94 void RAL_CALL ral_delete_scanline(double **x);
95 
97 typedef struct {
100  int n_points;
103  int n_parts;
104  OGRwkbGeometryType *part_types;
105  OGRwkbGeometryType type;
106 } ral_geometry;
107 
109 
110 ral_geometry_handle RAL_CALL ral_geometry_create(int n_points, int n_parts);
111 #ifdef RAL_HAVE_GDAL
112 ral_geometry_handle RAL_CALL ral_geometry_create_from_OGR(OGRGeometryH geom);
113 #endif
114 void RAL_CALL ral_geometry_destroy(ral_geometry **g);
115 
117 typedef struct {
118  ral_geometry *g;
119  int n;
120 } ral_layer;
121 
122 typedef ral_layer *ral_layer_handle;
123 
124 ral_layer_handle RAL_CALL ral_layer_create(int n_geometries);
125 void RAL_CALL ral_layer_destroy(ral_layer **l);
126 
127 #endif
an XYZM point
Definition: vector.h:9
ral_polygon * parts
Definition: vector.h:102
int RAL_CALL ral_scanline_at(ral_active_edge_table *aet_list, int n, double y, double **x, int *nx)
ral_active_edge_table_handle RAL_CALL ral_get_active_edge_tables(ral_polygon *p, int n)
two points: begin and end
Definition: vector.h:19
ral_point max
Definition: vector.h:31
int n
Definition: vector.h:51
ral_point min
Definition: vector.h:29
ral_point * nodes
Definition: vector.h:49
an array of points (nodes)
Definition: vector.h:47
an array of points, which represent a simple geometry
Definition: vector.h:97
for rendering a polygon with holes
Definition: vector.h:68
two points: SW and NE corners
Definition: vector.h:27
ral_point * points
Definition: vector.h:99
an array of geometries
Definition: vector.h:117