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