GRASS 8 Programmer's Manual 8.5.0RC1(2026)-3334b87d9c
Loading...
Searching...
No Matches
wind_in.c
Go to the documentation of this file.
1/*!
2 * \file lib/gis/wind_in.c
3 *
4 * \brief Point in region functions.
5 *
6 * This program is free software under the GNU General Public License
7 * (>=v2). Read the file COPYING that comes with GRASS for details.
8 *
9 * \author Hamish Bowman. (c) Hamish Bowman, and the GRASS Development Team
10 *
11 * \date February 2007
12 */
13
14#include <grass/gis.h>
15
16/*!
17 * \brief Returns TRUE if coordinate is within the current region settings.
18 *
19 * \param easting
20 * \param northing
21 * \return int
22 *
23 */
24int G_point_in_region(double easting, double northing)
25{
26 struct Cell_head window;
27
28 G_get_window(&window);
29
30 return G_point_in_window(easting, northing, &window);
31}
32
33/*!
34 * \brief Returns TRUE if coordinate is within the given map region.
35 *
36 * Use instead of G_point_in_region() when used in a loop (it's more
37 * efficient to only fetch the window once) or for checking if a point
38 * is in another region (e.g. contained with a raster map's bounds).
39 *
40 * \param easting
41 * \param northing
42 * \param window
43 * \return int
44 *
45 */
46int G_point_in_window(double easting, double northing,
47 const struct Cell_head *window)
48{
49
50 if (easting > window->east || easting < window->west ||
51 northing > window->north || northing < window->south)
52 return FALSE;
53
54 return TRUE;
55}
#define TRUE
Definition dbfopen.c:56
#define FALSE
Definition dbfopen.c:55
void G_get_window(struct Cell_head *window)
Get the current region.
Definition get_window.c:47
int G_point_in_window(double easting, double northing, const struct Cell_head *window)
Returns TRUE if coordinate is within the given map region.
Definition wind_in.c:46
int G_point_in_region(double easting, double northing)
Returns TRUE if coordinate is within the current region settings.
Definition wind_in.c:24