PageRenderTime 23ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/Proj4/pj_auth.c

http://github.com/route-me/route-me
C | 34 lines | 32 code | 1 blank | 1 comment | 1 complexity | 7aa5fcdf573190d6e88be0f01dbce4ec MD5 | raw file
  1. /* determine latitude from authalic latitude */
  2. #ifndef lint
  3. static const char SCCSID[]="@(#)pj_auth.c 4.3 93/06/12 GIE REL";
  4. #endif
  5. #include "projects.h"
  6. # define P00 .33333333333333333333
  7. # define P01 .17222222222222222222
  8. # define P02 .10257936507936507936
  9. # define P10 .06388888888888888888
  10. # define P11 .06640211640211640211
  11. # define P20 .01641501294219154443
  12. #define APA_SIZE 3
  13. double *
  14. pj_authset(double es) {
  15. double t, *APA;
  16. APA = (double *)pj_malloc(APA_SIZE * sizeof(double));
  17. if (APA) {
  18. APA[0] = es * P00;
  19. t = es * es;
  20. APA[0] += t * P01;
  21. APA[1] = t * P10;
  22. t *= es;
  23. APA[0] += t * P02;
  24. APA[1] += t * P11;
  25. APA[2] = t * P20;
  26. }
  27. return APA;
  28. }
  29. double
  30. pj_authlat(double beta, double *APA) {
  31. double t = beta+beta;
  32. return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t));
  33. }