xref: /plan9/sys/src/cmd/map/libmap/orthographic.c (revision 59cc4ca53493a3c6d2349fe2b7f7c40f7dce7294)
1 #include <u.h>
2 #include <libc.h>
3 #include "map.h"
4 
5 
6 int
Xorthographic(struct place * place,double * x,double * y)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
orthographic(void)15 orthographic(void)
16 {
17 	return(Xorthographic);
18 }
19 
20 int
olimb(double * lat,double * lon,double res)21 olimb(double *lat, double *lon, double res)
22 {
23 	static 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 }
36