plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

newyorker.c (409B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include "map.h"
      4 
      5 static double a;
      6 
      7 static int
      8 Xnewyorker(struct place *place, double *x, double *y)
      9 {
     10 	double r = PI/2 - place->nlat.l;
     11 	double s;
     12 	if(r<.001)	/* cheat to plot center */
     13 		s = 0;
     14 	else if(r<a)
     15 		return -1;
     16 	else
     17 		s = log(r/a);
     18 	*x = -s * place->wlon.s;
     19 	*y = -s * place->wlon.c;
     20 	return(1);
     21 }
     22 
     23 proj
     24 newyorker(double a0)
     25 {
     26 	a = a0*RAD;
     27 	return(Xnewyorker);
     28 }