diff options
Diffstat (limited to 'src/cmd/map/libmap/polyconic.c')
-rw-r--r-- | src/cmd/map/libmap/polyconic.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cmd/map/libmap/polyconic.c b/src/cmd/map/libmap/polyconic.c new file mode 100644 index 00000000..a07c97e3 --- /dev/null +++ b/src/cmd/map/libmap/polyconic.c @@ -0,0 +1,28 @@ +#include <u.h> +#include <libc.h> +#include "map.h" + +int +Xpolyconic(struct place *place, double *x, double *y) +{ + double r, alpha; + double lat2, lon2; + if(fabs(place->nlat.l) > .01) { + r = place->nlat.c / place->nlat.s; + alpha = place->wlon.l * place->nlat.s; + *y = place->nlat.l + r*(1 - cos(alpha)); + *x = - r*sin(alpha); + } else { + lon2 = place->wlon.l * place->wlon.l; + lat2 = place->nlat.l * place->nlat.l; + *y = place->nlat.l * (1+(lon2/2)*(1-(8+lon2)*lat2/12)); + *x = - place->wlon.l * (1-lat2*(3+lon2)/6); + } + return(1); +} + +proj +polyconic(void) +{ + return(Xpolyconic); +} |