URI:
       tmollweide.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
       ---
       tmollweide.c (431B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include "map.h"
            4 
            5 static int
            6 Xmollweide(struct place *place, double *x, double *y)
            7 {
            8         double z;
            9         double w;
           10         z = place->nlat.l;
           11         if(fabs(z)<89.9*RAD)
           12                 do {        /*newton for 2z+sin2z=pi*sin(lat)*/
           13                         w = (2*z+sin(2*z)-PI*place->nlat.s)/(2+2*cos(2*z));
           14                         z -= w;
           15                 } while(fabs(w)>=.00001);
           16         *y = sin(z);
           17         *x = - (2/PI)*cos(z)*place->wlon.l;
           18         return(1);
           19 }
           20 
           21 proj
           22 mollweide(void)
           23 {
           24         return(Xmollweide);
           25 }