aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/map/libmap/orthographic.c
blob: 7aac5b15d6eba9d9f17b6682df529877cf398d93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <u.h>
#include <libc.h>
#include "map.h"


int
Xorthographic(struct place *place, double *x, double *y)
{
	*x = - place->nlat.c * place->wlon.s;
	*y = - place->nlat.c * place->wlon.c;
	return(place->nlat.l<0.? 0 : 1);
}

proj
orthographic(void)
{
	return(Xorthographic);
}

int
olimb(double *lat, double *lon, double res)
{
	static int first  = 1;
	if(first) {
		*lat = 0;
		*lon = -180;
		first = 0;
		return 0;
	}
	*lon += res;
	if(*lon <= 180)
		return 1;
	first = 1;
	return -1;
}