[GRASS-dev] G_point_in_region() ?
Hamish
hamish_nospam at yahoo.com
Tue Feb 13 20:23:41 EST 2007
Before I add one to libgis, does anyone know if there is an existing lib
function that will test if a coordinate pair is inside or outside the
current region?
e.g.
/* is e,n in the current region? */
int point_in_region(double easting, double northing)
{
struct Cell_head window;
G_get_window(&window);
return point_in_window(easting, northing, window);
}
/* use directly when speed is important or for eg point in map */
int point_in_window(double easting, double northing,
struct Cell_head window)
{
if ( easting > window.east || easting < window.west ||
northing > window.north || northing < window.south)
return FALSE;
return TRUE;
}
a C question:
if (FALSE && G_something())
will stop as soon as it tests the first term (FALSE) and won't execute
G_something(), does OR work the same way?
if(TRUE || G_something())
is there a chance G_somthing() will get run in the OR case?
(the first term will know if the G_() call will be valid)
thanks,
Hamish
More information about the grass-dev
mailing list