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