Cartography-Projection-GCTP
view release on metacpan or search on metacpan
gctpc/molwfor.c view on Meta::CPAN
/*******************************************************************************
NAME MOLLWEIDE
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the MOllweide projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb, 1993
S. Nelson, EDC Jun, 2993; Made corrections in precision and
number of iterations.
ALGORITHM REFERENCES
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
*******************************************************************************/
#include "cproj.h"
/* Variables common to all subroutines in this code file
-----------------------------------------------------*/
static double lon_center; /* Center longitude (projection center) */
static double R; /* Radius of the earth (sphere) */
static double false_easting; /* x offset in meters */
static double false_northing; /* y offset in meters */
/* Initialize the Mollweide projection
------------------------------------*/
long molwforint(r, center_long,false_east,false_north)
double r; /* (I) Radius of the earth (sphere) */
double center_long; /* (I) Center longitude */
double false_east; /* x offset in meters */
double false_north; /* y offset in meters */
{
/* Place parameters in static storage for common use
-------------------------------------------------*/
false_easting = false_east;
false_northing = false_north;
R = r;
lon_center = center_long;
/* Report parameters to the user
-----------------------------*/
ptitle("MOLLWEIDE");
radius(r);
cenlon(center_long);
offsetp(false_easting,false_northing);
return(OK);
}
/* Mollweide forward equations--mapping lat,long to x,y
----------------------------------------------------*/
long molwfor(lon, lat, x, y)
double lon; /* (I) Longitude */
double lat; /* (I) Latitude */
double *x; /* (O) X projection coordinate */
double *y; /* (O) Y projection coordinate */
{
double delta_lon; /* Delta longitude (Given longitude - center */
double theta;
double delta_theta;
double con;
long i;
/* Forward equations
-----------------*/
( run in 0.888 second using v1.01-cache-2.11-cpan-71847e10f99 )