bicentric.c 437 B

12345678910111213141516171819202122232425
  1. #include <u.h>
  2. #include <libc.h>
  3. #include "map.h"
  4. static struct coord center;
  5. static int
  6. Xbicentric(struct place *place, double *x, double *y)
  7. {
  8. if(place->wlon.c<=.01||place->nlat.c<=.01)
  9. return(-1);
  10. *x = -center.c*place->wlon.s/place->wlon.c;
  11. *y = place->nlat.s/(place->nlat.c*place->wlon.c);
  12. return(*x**x+*y**y<=9);
  13. }
  14. proj
  15. bicentric(double l)
  16. {
  17. l = fabs(l);
  18. if(l>89)
  19. return(0);
  20. deg2rad(l,&center);
  21. return(Xbicentric);
  22. }