URI:
       tfisheye.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
       ---
       tfisheye.c (407B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include "map.h"
            4 /* refractive fisheye, not logarithmic */
            5 
            6 static double n;
            7 
            8 static int
            9 Xfisheye(struct place *place, double *x, double *y)
           10 {
           11         double r;
           12         double u = sin(PI/4-place->nlat.l/2)/n;
           13         if(fabs(u) > .97)
           14                 return -1;
           15         r = tan(asin(u));
           16         *x = -r*place->wlon.s;
           17         *y = -r*place->wlon.c;
           18         return 1;
           19 }
           20 
           21 proj
           22 fisheye(double par)
           23 {
           24         n = par;
           25         return n<.1? 0: Xfisheye;
           26 }