plan9port

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

bicentric.c (437B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include "map.h"
      4 
      5 static struct coord center;
      6 
      7 static int
      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
     18 bicentric(double l)
     19 {
     20 	l = fabs(l);
     21 	if(l>89)
     22 		return(0);
     23 	deg2rad(l,&center);
     24 	return(Xbicentric);
     25 }