Exemple #1
0
        protected PJ_stere setup()
        {         // general initialization
            double t = Math.Abs(phi0);

            if (Math.Abs(t - Proj.HALFPI) < EPS10)
            {
                mode = phi0 < 0.0?stere_mode.S_POLE:stere_mode.N_POLE;
            }
            else
            {
                mode = t > EPS10?stere_mode.OBLIQ:stere_mode.EQUIT;
            }

            phits = Math.Abs(phits);
            if (es != 0)
            {
                switch (mode)
                {
                case stere_mode.N_POLE:
                case stere_mode.S_POLE:
                    if (Math.Abs(phits - Proj.HALFPI) < EPS10)
                    {
                        akm1 = 2.0 * k0 / Math.Sqrt(Math.Pow(1 + e, 1 + e) * Math.Pow(1 - e, 1 - e));
                    }
                    else
                    {
                        t     = Math.Sin(phits);
                        akm1  = Math.Cos(phits) / Proj.pj_tsfn(phits, t, e);
                        t    *= e;
                        akm1 /= Math.Sqrt(1.0 - t * t);
                    }
                    break;

                case stere_mode.EQUIT:
                case stere_mode.OBLIQ:
                    t = Math.Sin(phi0);
                    double X = 2.0 * Math.Atan(ssfn_(phi0, t, e)) - Proj.HALFPI;
                    t    *= e;
                    akm1  = 2.0 * k0 * Math.Cos(phi0) / Math.Sqrt(1.0 - t * t);
                    sinX1 = Math.Sin(X);
                    cosX1 = Math.Cos(X);
                    break;
                }
                inv = e_inverse;
                fwd = e_forward;
            }
            else
            {
                switch (mode)
                {
                case stere_mode.OBLIQ:
                    sinX1 = Math.Sin(phi0);
                    cosX1 = Math.Cos(phi0);
                    goto case stere_mode.EQUIT;

                case stere_mode.EQUIT:
                    akm1 = 2.0 * k0;
                    break;

                case stere_mode.S_POLE:
                case stere_mode.N_POLE:
                    akm1 = Math.Abs(phits - Proj.HALFPI) >= EPS10?Math.Cos(phits) / Math.Tan(Proj.FORTPI - 0.5 * phits) : 2.0 * k0;

                    break;
                }
                inv = s_inverse;
                fwd = s_forward;
            }

            return(this);
        }
Exemple #2
0
        protected PJ_stere setup()
        {
            // general initialization
            double t=Math.Abs(phi0);

            if(Math.Abs(t-Proj.HALFPI)<EPS10) mode=phi0<0.0?stere_mode.S_POLE:stere_mode.N_POLE;
            else mode=t>EPS10?stere_mode.OBLIQ:stere_mode.EQUIT;

            phits=Math.Abs(phits);
            if(es!=0)
            {
                switch(mode)
                {
                    case stere_mode.N_POLE:
                    case stere_mode.S_POLE:
                        if(Math.Abs(phits-Proj.HALFPI)<EPS10) akm1=2.0*k0/Math.Sqrt(Math.Pow(1+e, 1+e)*Math.Pow(1-e, 1-e));
                        else
                        {
                            t=Math.Sin(phits);
                            akm1=Math.Cos(phits)/Proj.pj_tsfn(phits, t, e);
                            t*=e;
                            akm1/=Math.Sqrt(1.0-t*t);
                        }
                        break;
                    case stere_mode.EQUIT:
                    case stere_mode.OBLIQ:
                        t=Math.Sin(phi0);
                        double X=2.0*Math.Atan(ssfn_(phi0, t, e))-Proj.HALFPI;
                        t*=e;
                        akm1=2.0*k0*Math.Cos(phi0)/Math.Sqrt(1.0-t*t);
                        sinX1=Math.Sin(X);
                        cosX1=Math.Cos(X);
                        break;
                }
                inv=e_inverse;
                fwd=e_forward;
            }
            else
            {
                switch(mode)
                {
                    case stere_mode.OBLIQ:
                        sinX1=Math.Sin(phi0);
                        cosX1=Math.Cos(phi0);
                        goto case stere_mode.EQUIT;
                    case stere_mode.EQUIT:
                        akm1=2.0*k0;
                        break;
                    case stere_mode.S_POLE:
                    case stere_mode.N_POLE:
                        akm1=Math.Abs(phits-Proj.HALFPI)>=EPS10?Math.Cos(phits)/Math.Tan(Proj.FORTPI-0.5*phits):2.0*k0;
                        break;
                }
                inv=s_inverse;
                fwd=s_forward;
            }

            return this;
        }