Menu

[r4420]: / trunk / toolkits / basemap / src / adjlon.c  Maximize  Restore  History

Download this file

19 lines (16 with data), 539 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
/* reduce argument to range +/- PI */
#ifndef lint
static const char SCCSID[]="@(#)adjlon.c 4.3 93/06/12 GIE REL";
#endif
#include <math.h>
#include <projects.h>
#define SPI 3.14159265359
#define TWOPI 6.2831853071795864769
#define ONEPI 3.14159265358979323846
double adjlon (double lon) {
if (fabs(lon) <= SPI) return( lon );
lon += ONEPI; /* adjust to 0..2pi rad */
lon -= TWOPI * floor(lon / TWOPI); /* remove integral # of 'revolutions'*/
lon -= ONEPI; /* adjust back to -pi..pi rad */
return( lon );
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.