File:  [Research Unix] / researchv10no / cmd / map / libmap / harrison.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

#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<sqrt(r*r-1))
		return 0;
	return Xharrison;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.