URI:
       tpolyconic.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
       ---
       tpolyconic.c (584B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include "map.h"
            4 
            5 int
            6 Xpolyconic(struct place *place, double *x, double *y)
            7 {
            8         double r, alpha;
            9         double lat2, lon2;
           10         if(fabs(place->nlat.l) > .01) {
           11                 r = place->nlat.c / place->nlat.s;
           12                 alpha = place->wlon.l * place->nlat.s;
           13                 *y = place->nlat.l + r*(1 - cos(alpha));
           14                 *x = - r*sin(alpha);
           15         } else {
           16                 lon2 = place->wlon.l * place->wlon.l;
           17                 lat2 = place->nlat.l * place->nlat.l;
           18                 *y = place->nlat.l * (1+(lon2/2)*(1-(8+lon2)*lat2/12));
           19                 *x = - place->wlon.l * (1-lat2*(3+lon2)/6);
           20         }
           21         return(1);
           22 }
           23 
           24 proj
           25 polyconic(void)
           26 {
           27         return(Xpolyconic);
           28 }