00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <grass/gis.h>
00021 #include <grass/Vect.h>
00022
00023 double
00024 dig_x_intersect (
00025 double beg_x,
00026 double end_x,
00027 double beg_y,
00028 double end_y,
00029 double Y)
00030 {
00031 double b, a;
00032
00033 b = (end_x - beg_x) / (end_y - beg_y);
00034 a = beg_x - b * beg_y;
00035 return (a + b * Y);
00036 }
00037
00038 int
00039 dig_in_area_bbox (
00040 P_AREA * Area,
00041 double x, double y)
00042 {
00043 #ifdef GDEBUG
00044 G_debug (3, "BBOX: (x,y) (%lf, %lf)\n", x, y);
00045 G_debug (3, "NSEW: %lf, %lf, %lf, %lf\n", Area->N, Area->S, Area->E, Area->W);
00046 #endif
00047 if (x < Area->W)
00048 return (0);
00049 if (x > Area->E)
00050 return (0);
00051 if (y < Area->S)
00052 return (0);
00053 if (y > Area->N)
00054 return (0);
00055
00056 return (1);
00057 }
00058