newyorker.c 409 B

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