From 28994509cc11ac6a5443054dfae1fedfb69039bc Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 21 Apr 2004 22:19:33 +0000 Subject: Why not? --- src/cmd/map/libmap/harrison.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/cmd/map/libmap/harrison.c (limited to 'src/cmd/map/libmap/harrison.c') diff --git a/src/cmd/map/libmap/harrison.c b/src/cmd/map/libmap/harrison.c new file mode 100644 index 00000000..6b6003c2 --- /dev/null +++ b/src/cmd/map/libmap/harrison.c @@ -0,0 +1,40 @@ +#include +#include +#include "map.h" + +static double v3,u2,u3,a,b; /*v=view,p=obj,u=unit.y*/ + +static int +Xharrison(struct place *place, double *x, double *y) +{ + double p1 = -place->nlat.c*place->wlon.s; + double p2 = -place->nlat.c*place->wlon.c; + double p3 = place->nlat.s; + double d = b + u3*p2 - u2*p3; + double t; + if(d < .01) + return -1; + t = a/d; + if(v3*place->nlat.s < 1.) + return -1; + *y = t*p2*u2 + (v3-t*(v3-p3))*u3; + *x = t*p1; + if(t < 0) + return 0; + if(*x * *x + *y * *y > 16) + return -1; + return 1; +} + +proj +harrison(double r, double alpha) +{ + u2 = cos(alpha*RAD); + u3 = sin(alpha*RAD); + v3 = r; + b = r*u2; + a = 1 + b; + if(r<1.001 || a