/Proj4/PJ_hammer.c

http://github.com/route-me/route-me · C · 32 lines · 31 code · 1 blank · 0 comment · 5 complexity · 036a70cbbdc0292eb81c572020dabdf0 MD5 · raw file

  1. #ifndef lint
  2. static const char SCCSID[]="@(#)PJ_hammer.c 4.1 94/02/15 GIE REL";
  3. #endif
  4. #define PROJ_PARMS__ \
  5. double w; \
  6. double m, rm;
  7. #define PJ_LIB__
  8. # include "projects.h"
  9. PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff")
  10. "\n\tMisc Sph, no inv.\n\tW= M=";
  11. FORWARD(s_forward); /* spheroid */
  12. double cosphi, d;
  13. d = sqrt(2./(1. + (cosphi = cos(lp.phi)) * cos(lp.lam *= P->w)));
  14. xy.x = P->m * d * cosphi * sin(lp.lam);
  15. xy.y = P->rm * d * sin(lp.phi);
  16. return (xy);
  17. }
  18. FREEUP; if (P) pj_dalloc(P); }
  19. ENTRY0(hammer)
  20. if (pj_param(P->params, "tW").i) {
  21. if ((P->w = fabs(pj_param(P->params, "dW").f)) <= 0.) E_ERROR(-27);
  22. } else
  23. P->w = .5;
  24. if (pj_param(P->params, "tM").i) {
  25. if ((P->m = fabs(pj_param(P->params, "dM").f)) <= 0.) E_ERROR(-27);
  26. } else
  27. P->m = 1.;
  28. P->rm = 1. / P->m;
  29. P->m /= P->w;
  30. P->es = 0.; P->fwd = s_forward;
  31. ENDENTRY(P)