示例#1
0
 public static LP pj_gauss(projCtx ctx, LP elp, GAUSS en)
 {
     LP slp;
     slp.phi=2.0*Math.Atan(en.K*Math.Pow(Math.Tan(0.5*elp.phi+Proj.FORTPI), en.C)*srat(en.e*Math.Sin(elp.phi), en.ratexp))-Proj.HALFPI;
     slp.lam=en.C*elp.lam;
     return slp;
 }
示例#2
0
        public static LP pj_inv_gauss(projCtx ctx, LP slp, GAUSS en)
        {
            const int MAX_ITER = 20;
            LP        elp;

            elp.phi = 0;

            elp.lam = slp.lam / en.C;
            double num = Math.Pow(Math.Tan(0.5 * slp.phi + Proj.FORTPI) / en.K, 1.0 / en.C);

            int i = MAX_ITER;

            for (; i > 0; i--)
            {
                elp.phi = 2.0 * Math.Atan(num * srat(en.e * Math.Sin(slp.phi), -0.5 * en.e)) - Proj.HALFPI;
                if (Math.Abs(elp.phi - slp.phi) < TOL14)
                {
                    break;
                }
                slp.phi = elp.phi;
            }

            // convergence failed
            if (i == 0)
            {
                Proj.pj_ctx_set_errno(ctx, -17);
            }
            return(elp);
        }
示例#3
0
        public static LP pj_gauss(projCtx ctx, LP elp, GAUSS en)
        {
            LP slp;

            slp.phi = 2.0 * Math.Atan(en.K * Math.Pow(Math.Tan(0.5 * elp.phi + Proj.FORTPI), en.C) * srat(en.e * Math.Sin(elp.phi), en.ratexp)) - Proj.HALFPI;
            slp.lam = en.C * elp.lam;
            return(slp);
        }
示例#4
0
        public override PJ Init()
        {
            double R;

            en=GAUSS.pj_gauss_ini(e, phi0, out phic0, out R);
            if(en==null) return null;

            sinc0=Math.Sin(phic0);
            cosc0=Math.Cos(phic0);
            R2=2.0*R;
            inv=e_inverse;
            fwd=e_forward;

            return this;
        }
示例#5
0
        public static LP pj_inv_gauss(projCtx ctx, LP slp, GAUSS en)
        {
            const int MAX_ITER=20;
            LP elp;
            elp.phi=0;

            elp.lam=slp.lam/en.C;
            double num=Math.Pow(Math.Tan(0.5*slp.phi+Proj.FORTPI)/en.K, 1.0/en.C);

            int i=MAX_ITER;
            for(; i>0; i--)
            {
                elp.phi=2.0*Math.Atan(num*srat(en.e*Math.Sin(slp.phi), -0.5*en.e))-Proj.HALFPI;
                if(Math.Abs(elp.phi-slp.phi)<TOL14) break;
                slp.phi=elp.phi;
            }

            // convergence failed
            if(i==0) Proj.pj_ctx_set_errno(ctx, -17);
            return elp;
        }
示例#6
0
        public static GAUSS pj_gauss_ini(double e, double phi0, out double chi, out double rc)
        {
            chi = rc = 0;
            try
            {
                GAUSS en = new GAUSS();

                double es = e * e;
                en.e = e;
                double sphi = Math.Sin(phi0);
                double cphi = Math.Cos(phi0);
                cphi     *= cphi;
                rc        = Math.Sqrt(1.0 - es) / (1.0 - es * sphi * sphi);
                en.C      = Math.Sqrt(1.0 + es * cphi * cphi / (1.0 - es));
                chi       = Math.Asin(sphi / en.C);
                en.ratexp = 0.5 * en.C * e;
                en.K      = Math.Tan(0.5 * chi + Proj.FORTPI) / (Math.Pow(Math.Tan(0.5 * phi0 + Proj.FORTPI), en.C) * srat(en.e * sphi, en.ratexp));
                return(en);
            }
            catch
            {
                return(null);
            }
        }
示例#7
0
        public static GAUSS pj_gauss_ini(double e, double phi0, out double chi, out double rc)
        {
            chi=rc=0;
            try
            {
                GAUSS en=new GAUSS();

                double es=e*e;
                en.e=e;
                double sphi=Math.Sin(phi0);
                double cphi=Math.Cos(phi0);
                cphi*=cphi;
                rc=Math.Sqrt(1.0-es)/(1.0-es*sphi*sphi);
                en.C=Math.Sqrt(1.0+es*cphi*cphi/(1.0-es));
                chi=Math.Asin(sphi/en.C);
                en.ratexp=0.5*en.C*e;
                en.K=Math.Tan(0.5*chi+Proj.FORTPI)/(Math.Pow(Math.Tan(0.5*phi0+Proj.FORTPI), en.C)*srat(en.e*sphi, en.ratexp));
                return en;
            }
            catch
            {
                return null;
            }
        }