~ubuntu-branches/ubuntu/trusty/proj/trusty

« back to all changes in this revision

Viewing changes to src/PJ_gstmerc.c

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2008-11-26 17:49:22 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20081126174922-qeeypwpnyf8ttxtx
Tags: 4.6.1-1
* New upstream release.
* Added Homepage and Vcs-* fields into debian/control.
* Policy bumped to 3.8.0 (no changes).
* Added US NAD83/NAD27, Canadian and French datum grids as distributed
  in http://download.osgeo.org/proj/proj-datumgrid-1.4.zip 
  (closes: #458369)
* Added dpatch support.
* [PATCH] manpages fixes manpages known typos. 
  (closes: #407399, #407400, #407401, #407402)
* Added a README.sources with comments about datum grids.
* Moved to level debhelper level 7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef lint
 
2
static const char SCCSID[]="@(#)PJ_gstmerc.c    4.6     08/07/28        DGR     IGN";
 
3
#endif
 
4
#define PROJ_PARMS__ \
 
5
        double lamc;\
 
6
        double phic;\
 
7
        double c;\
 
8
        double n1;\
 
9
        double n2;\
 
10
    double XS;\
 
11
    double YS;
 
12
 
 
13
#define PJ_LIB__
 
14
# include       <projects.h>
 
15
PROJ_HEAD(gstmerc, "Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)")
 
16
        "\n\tCyl, Sph&Ell\n\tlat_0= lon_0= k_0=";
 
17
FORWARD(s_forward); /* spheroid */
 
18
        double L, Ls, sinLs1, Ls1;
 
19
        L= P->n1*lp.lam;
 
20
    Ls= P->c+P->n1*log(pj_tsfn(-1.0*lp.phi,-1.0*sin(lp.phi),P->e));
 
21
    sinLs1= sin(L)/cosh(Ls);
 
22
    Ls1= log(pj_tsfn(-1.0*asin(sinLs1),0.0,0.0));
 
23
    xy.x= (P->XS + P->n2*Ls1)*P->ra;
 
24
    xy.y= (P->YS + P->n2*atan(sinh(Ls)/cos(L)))*P->ra;
 
25
        return (xy);
 
26
}
 
27
INVERSE(s_inverse); /* spheroid */
 
28
        double L, LC, sinC;
 
29
        L= atan(sinh((xy.x - P->XS)*P->a/P->n2)/cos((xy.y - P->YS)*P->a/P->n2));
 
30
    sinC= sin((xy.y - P->YS)*P->a/P->n2)/cosh((xy.x - P->XS)*P->a/P->n2);
 
31
    LC= log(pj_tsfn(-1.0*asin(sinC),0.0,0.0));
 
32
    lp.lam= L/P->n1;
 
33
    lp.phi= -1.0*pj_phi2(exp((LC-P->c)/P->n1),P->e);
 
34
        return (lp);
 
35
}
 
36
FREEUP; if (P) pj_dalloc(P); }
 
37
ENTRY0(gstmerc)
 
38
    P->n1= sqrt(1.0+P->es*pow(cos(P->phi0),4.0)/(1.0-P->es));
 
39
    P->phic= asin(sin(P->phi0)/P->n1);
 
40
    P->c=       log(pj_tsfn(-1.0*P->phic,0.0,0.0))
 
41
         -P->n1*log(pj_tsfn(-1.0*P->phi0,-1.0*sin(P->phi0),P->e));
 
42
    P->n2= P->k0*P->a*sqrt(1.0-P->es)/(1.0-P->es*sin(P->phi0)*sin(P->phi0));
 
43
    P->XS= 0;
 
44
    P->YS= -1.0*P->n2*P->phic;
 
45
        P->inv= s_inverse;
 
46
        P->fwd= s_forward;
 
47
ENDENTRY(P)