plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

conic.c (496B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include "map.h"
      4 
      5 static struct coord stdpar;
      6 
      7 static int
      8 Xconic(struct place *place, double *x, double *y)
      9 {
     10 	double r;
     11 	if(fabs(place->nlat.l-stdpar.l) > 80.*RAD)
     12 		return(-1);
     13 	r = stdpar.c/stdpar.s - tan(place->nlat.l - stdpar.l);
     14 	*x = - r*sin(place->wlon.l * stdpar.s);
     15 	*y = - r*cos(place->wlon.l * stdpar.s);
     16 	if(r>3) return(0);
     17 	return(1);
     18 }
     19 
     20 proj
     21 conic(double par)
     22 {
     23 	if(fabs(par) <.1)
     24 		return(Xcylindrical);
     25 	deg2rad(par, &stdpar);
     26 	return(Xconic);
     27 }