Blob
1 #include <u.h>2 #include <libc.h>3 #include "map.h"5 static int6 Xmercator(struct place *place, double *x, double *y)7 {8 if(fabs(place->nlat.l) > 80.*RAD)9 return(-1);10 *x = -place->wlon.l;11 *y = 0.5*log((1+place->nlat.s)/(1-place->nlat.s));12 return(1);13 }15 proj16 mercator(void)17 {18 return(Xmercator);19 }21 static double ecc = ECC;23 static int24 Xspmercator(struct place *place, double *x, double *y)25 {26 if(Xmercator(place,x,y) < 0)27 return(-1);28 *y += 0.5*ecc*log((1-ecc*place->nlat.s)/(1+ecc*place->nlat.s));29 return(1);30 }32 proj33 sp_mercator(void)34 {35 return(Xspmercator);36 }