GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
rhumbline.c File Reference

GIS Library - Rhumbline calculation routines. More...

#include <math.h>
#include <grass/gis.h>
#include "pi.h"
Include dependency graph for rhumbline.c:

Go to the source code of this file.

Functions

int G_begin_rhumbline_equation (double lon1, double lat1, double lon2, double lat2)
 Start rhumbline calculations. More...
 
double G_rhumbline_lat_from_lon (double lon)
 Calculates rhumbline latitude. More...
 

Detailed Description

GIS Library - Rhumbline calculation routines.

From "Map Projections" by Peter Richardus and Ron K. Alder, 1972
(526.8 R39m in Map & Geography Library)
Page 20,21, formulas 2.21, 2.22

Formula is the equation of a rhumbline from (lat1,lon1) to (lat2,lon2). Input is lon, output is lat (all in degrees).

Note: Formula only works if 0 < abs(lon2-lon1) < 180. If lon1 == lon2 then rhumbline is the merdian lon1 (and the formula will fail).
WARNING: This code is preliminary. It may not even be correct.

(C) 2001-2014 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
GRASS GIS Development Team
Date
1999-2014

Definition in file rhumbline.c.

Function Documentation

◆ G_begin_rhumbline_equation()

int G_begin_rhumbline_equation ( double  lon1,
double  lat1,
double  lon2,
double  lat2 
)

Start rhumbline calculations.

Note: This function must be called before other rhumbline functions to initialize parameters.

Parameters
[in]lon1,lat1longitude, latitude of first point
[in]lon2,lat2longitude, latitude of second point
Returns
1 on success
0 on error

Definition at line 58 of file rhumbline.c.

◆ G_rhumbline_lat_from_lon()

double G_rhumbline_lat_from_lon ( double  lon)

Calculates rhumbline latitude.

Note: Function only works if lon1 < lon < lon2.

Parameters
[in]lonlongitude
Returns
double latitude in degrees

Definition at line 97 of file rhumbline.c.

References Degrees, M_PI_2, Radians, and st.