aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/map/libmap/conic.c
blob: ba4430c68ea2a3a6b36619048d7968db2417b192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <u.h>
#include <libc.h>
#include "map.h"

static struct coord stdpar;

static int
Xconic(struct place *place, double *x, double *y)
{
	double r;
	if(fabs(place->nlat.l-stdpar.l) > 80.*RAD)
		return(-1);
	r = stdpar.c/stdpar.s - tan(place->nlat.l - stdpar.l);
	*x = - r*sin(place->wlon.l * stdpar.s);
	*y = - r*cos(place->wlon.l * stdpar.s);
	if(r>3) return(0);
	return(1);
}

proj
conic(double par)
{
	if(fabs(par) <.1)
		return(Xcylindrical);
	deg2rad(par, &stdpar);
	return(Xconic);
}