Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/map/libmap/elliptic.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include "map.h"
4
 
5
struct coord center;
6
 
7
static int
8
Xelliptic(struct place *place, double *x, double *y)
9
{
10
	double r1,r2;
11
	r1 = acos(place->nlat.c*(place->wlon.c*center.c
12
		- place->wlon.s*center.s));
13
	r2 = acos(place->nlat.c*(place->wlon.c*center.c
14
		+ place->wlon.s*center.s));
15
	*x = -(r1*r1 - r2*r2)/(4*center.l);
16
	*y = (r1*r1+r2*r2)/2 - (center.l*center.l+*x**x);
17
	if(*y < 0)
18
		*y = 0;
19
	*y = sqrt(*y);
20
	if(place->nlat.l<0)
21
		*y = -*y;
22
	return(1);
23
}
24
 
25
proj
26
elliptic(double l)
27
{
28
	l = fabs(l);
29
	if(l>89)
30
		return(0);
31
	if(l<1)
32
		return(Xazequidistant);
33
	deg2rad(l,&center);
34
	return(Xelliptic);
35
}