/Proj4/PJ_tcea.c

http://github.com/route-me/route-me · C · 30 lines · 29 code · 1 blank · 0 comment · 1 complexity · 2ea3ed35277cc32c04a9aa90fc716bfa MD5 · raw file

  1. #ifndef lint
  2. static const char SCCSID[]="@(#)PJ_tcea.c 4.1 94/02/15 GIE REL";
  3. #endif
  4. #define PROJ_PARMS__ \
  5. double rk0;
  6. #define PJ_LIB__
  7. #include "projects.h"
  8. PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") "\n\tCyl, Sph";
  9. FORWARD(s_forward); /* spheroid */
  10. xy.x = P->rk0 * cos(lp.phi) * sin(lp.lam);
  11. xy.y = P->k0 * (atan2(tan(lp.phi), cos(lp.lam)) - P->phi0);
  12. return (xy);
  13. }
  14. INVERSE(s_inverse); /* spheroid */
  15. double t;
  16. xy.y = xy.y * P->rk0 + P->phi0;
  17. xy.x *= P->k0;
  18. t = sqrt(1. - xy.x * xy.x);
  19. lp.phi = asin(t * sin(xy.y));
  20. lp.lam = atan2(xy.x, t * cos(xy.y));
  21. return (lp);
  22. }
  23. FREEUP; if (P) pj_dalloc(P); }
  24. ENTRY0(tcea)
  25. P->rk0 = 1 / P->k0;
  26. P->inv = s_inverse;
  27. P->fwd = s_forward;
  28. P->es = 0.;
  29. ENDENTRY(P)