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_unix/sys/src/cmd/map/libmap/simpleconic.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
static double r0, a;
6
 
7
static int
8
Xsimpleconic(struct place *place, double *x, double *y)
9
{
10
	double r = r0 - place->nlat.l;
11
	double t = a*place->wlon.l;
12
	*x = -r*sin(t);
13
	*y = -r*cos(t);
14
	return 1;
15
}
16
 
17
proj
18
simpleconic(double par0, double par1)
19
{
20
	struct coord lat0;
21
	struct coord lat1;
22
	deg2rad(par0,&lat0);
23
	deg2rad(par1,&lat1);
24
	if(fabs(lat0.l+lat1.l)<.01)
25
		return rectangular(par0);
26
	if(fabs(lat0.l-lat1.l)<.01) {
27
		a = lat0.s/lat0.l;
28
		r0 = lat0.c/lat0.s + lat0.l;
29
	} else {
30
		a = (lat1.c-lat0.c)/(lat0.l-lat1.l);
31
		r0 = ((lat0.c+lat1.c)/a + lat1.l + lat0.l)/2;
32
	}
33
	return Xsimpleconic;
34
}