GRASS 8 Programmer's Manual
8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
short_way.c
Go to the documentation of this file.
1
/*!
2
* \file lib/gis/short_way.c
3
*
4
* \brief GIS Library - Shortest path functions.
5
*
6
* (C) 2001-2009 by the GRASS Development Team
7
*
8
* This program is free software under the GNU General Public License
9
* (>=v2). Read the file COPYING that comes with GRASS for details.
10
*
11
* \author Original author CERL
12
*/
13
14
#include <
grass/gis.h
>
15
16
/*!
17
* \brief Shortest way between two eastings.
18
*
19
* For lat-lon projection (<tt>PROJECTION_LL</tt>), <i>east1</i>,
20
* <i>east2</i> are changed so that they are no more than 180 degrees
21
* apart. Their true locations are not changed. For all other
22
* projections, this function does nothing.
23
*
24
* \param[in,out] east1 east (x) coordinate of first point
25
* \param[in,out] east2 east (x) coordinate of second point
26
*/
27
void
G_shortest_way
(
double
*
east1
,
double
*
east2
)
28
{
29
if
(
G_projection
() ==
PROJECTION_LL
) {
30
if
(*
east1
> *
east2
)
31
while
((*
east1
- *
east2
) > 180)
32
*
east2
+= 360;
33
else
if
(*
east2
> *
east1
)
34
while
((*
east2
- *
east1
) > 180)
35
*
east1
+= 360;
36
}
37
}
AMI_STREAM
Definition
ami_stream.h:153
G_projection
int G_projection(void)
Query cartographic projection.
Definition
proj1.c:32
gis.h
PROJECTION_LL
#define PROJECTION_LL
Projection code - Latitude-Longitude.
Definition
gis.h:129
G_shortest_way
void G_shortest_way(double *east1, double *east2)
Shortest way between two eastings.
Definition
short_way.c:27
lib
gis
short_way.c
Generated on Sun Apr 12 2026 06:59:15 for GRASS 8 Programmer's Manual by
1.9.8