plan9port

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

orthographic.c (494B)


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