orthographic.c 490 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <u.h>
  2. #include <libc.h>
  3. #include "map.h"
  4. int
  5. Xorthographic(struct place *place, double *x, double *y)
  6. {
  7. *x = - place->nlat.c * place->wlon.s;
  8. *y = - place->nlat.c * place->wlon.c;
  9. return(place->nlat.l<0.? 0 : 1);
  10. }
  11. proj
  12. orthographic(void)
  13. {
  14. return(Xorthographic);
  15. }
  16. int
  17. olimb(double *lat, double *lon, double res)
  18. {
  19. static first = 1;
  20. if(first) {
  21. *lat = 0;
  22. *lon = -180;
  23. first = 0;
  24. return 0;
  25. }
  26. *lon += res;
  27. if(*lon <= 180)
  28. return 1;
  29. first = 1;
  30. return -1;
  31. }