URI:
       tbonne.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tbonne.c (664B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include "map.h"
            4 
            5 static struct coord stdpar;
            6 static double r0;
            7 
            8 static int
            9 Xbonne(struct place *place, double *x, double *y)
           10 {
           11         double r, alpha;
           12         r = r0 - place->nlat.l;
           13         if(r<.001)
           14                 if(fabs(stdpar.c)<1e-10)
           15                         alpha = place->wlon.l;
           16                 else if(fabs(place->nlat.c)==0)
           17                         alpha = 0;
           18                 else
           19                         alpha = place->wlon.l/(1+
           20                                 stdpar.c*stdpar.c*stdpar.c/place->nlat.c/3);
           21         else
           22                 alpha = place->wlon.l * place->nlat.c / r;
           23         *x = - r*sin(alpha);
           24         *y = - r*cos(alpha);
           25         return(1);
           26 }
           27 
           28 proj
           29 bonne(double par)
           30 {
           31         if(fabs(par*RAD) < .01)
           32                 return(Xsinusoidal);
           33         deg2rad(par, &stdpar);
           34         r0 = stdpar.c/stdpar.s + stdpar.l;
           35         return(Xbonne);
           36 }