[GRASS-dev] G_point_in_region() ?
Dylan Beaudette
dylan.beaudette at gmail.com
Wed Feb 14 00:45:50 EST 2007
On 2/13/07, Hamish <hamish_nospam at yahoo.com> wrote:
> 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
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
Hi Hamish, I think that this would be a great convenience
to have, especially since there are a couple bugs in v.drape which
could be fixed with a quick call to point_in_region() at each vertex.
Cheers,
Dylan
More information about the grass-dev
mailing list