コード例 #1
0
 //本影の輪郭を計算する。qは角度で与えられる
 public static void getUmbralOutline(VesselElements ve, double q, double[] result)
 {
     getOutline(ve, ve.getL2(), ve.getTanf2(), q, result);
 }
コード例 #2
0
    //食分を計算する
    public static void getD(VesselElements ve, double longitude, double latitude, double altitude)//, double[] result)
    {
        longitude = longitude / 180.0 * Math.PI;
        latitude  = latitude / 180.0 * Math.PI;

        //測地緯度と地心緯度の差を計算
        double deltalat = 3.3584196 * 0.001 * Math.Sin(2 * latitude) - 5.635 * 0.000001 * Math.Sin(4 * latitude) + 1.7 * Math.Pow(10, -8) * Math.Sin(8 * latitude);

        //地心直交座標を計算
        double sinlat = Math.Sin(latitude);
        double N      = 1 / Math.Sqrt(1 - Constants.e2 * sinlat * sinlat);

        double u = (N + altitude) * Math.Cos(latitude) * Math.Cos(longitude);
        double v = (N + altitude) * Math.Cos(latitude) * Math.Sin(longitude);
        double w = (N * (1.0 - Constants.e2) + altitude) * Math.Sin(latitude);

        //基準座標
        double myu = ve.getMyu();
        double d   = ve.getDeclination();

        double x = u * Math.Sin(myu) + v * Math.Cos(myu);
        double y = -u *Math.Cos(myu) * Math.Sin(d) + v * Math.Sin(myu) * Math.Sin(d) + w * Math.Cos(d);

        double z = u * Math.Cos(myu) * Math.Cos(d) - v * Math.Sin(myu) * Math.Cos(d) + w * Math.Sin(d);

        //r,deltaを計算する
        double r     = Math.Sqrt(x * x + y * y + z * z);
        double xdiff = x - ve.getX0();
        double ydiff = y - ve.getY0();
        double delta = Math.Sqrt(xdiff * xdiff + ydiff * ydiff);

        //cosQ, sinQを計算する
        double cosQ = xdiff / delta;
        double sinQ = ydiff / delta;

        //月の北極方向角を計算する
        double tanphai = (xdiff / ydiff) + 0.0000426 * xdiff * Math.Tan(d) / (sinQ * sinQ);
        double moon_angle_to_northpole = Math.Atan(tanphai) / Math.PI * 180;

        if (moon_angle_to_northpole < 0)
        {
            moon_angle_to_northpole += 360;
        }
        else if (moon_angle_to_northpole > 360)
        {
            moon_angle_to_northpole -= 360;
        }
        if (ydiff > 0)
        {
            if (moon_angle_to_northpole > 270 | moon_angle_to_northpole < 90)
            {
                moon_angle_to_northpole += 180;
            }
        }
        else if (ydiff < 0)
        {
            if (moon_angle_to_northpole > 90 & moon_angle_to_northpole < 270)
            {
                moon_angle_to_northpole += 180;
            }
        }
        if (moon_angle_to_northpole > 360)
        {
            moon_angle_to_northpole -= 360;
        }

        //天頂の北極方位角を計算する
        double tannyu = x / y - delta * latitude * r * x * Math.Cos(d) / (y * y * Math.Cos(latitude));
        double zenith_angle_to_northpole = Math.Atan(tannyu) / Math.PI * 180;

        if (zenith_angle_to_northpole < 0)
        {
            zenith_angle_to_northpole += 360;
        }
        else if (zenith_angle_to_northpole > 360)
        {
            zenith_angle_to_northpole -= 360;
        }

        if (y < 0)
        {
            if (zenith_angle_to_northpole > 270 | zenith_angle_to_northpole < 90)
            {
                zenith_angle_to_northpole += 180;
            }
        }
        else if (y > 0)
        {
            if (zenith_angle_to_northpole > 90 & zenith_angle_to_northpole < 270)
            {
                zenith_angle_to_northpole += 180;
            }
        }
        if (zenith_angle_to_northpole > 360)
        {
            zenith_angle_to_northpole -= 360;
        }

        double omega = moon_angle_to_northpole - zenith_angle_to_northpole;

        if (Math.Abs(omega) > 180)
        {
            if (omega < 0)
            {
                omega += 360;
            }
            else if (omega > 0)
            {
                omega -= 360;
            }
        }
        //omega = omega / Math.PI * 180.0;
        // Debug.Log("omega= " + omega);
        //食分を求める
        double D = (ve.getL1() - z * ve.getTanf1() - delta) / (ve.getL1() + ve.getL2() - z * (ve.getTanf1() + ve.getTanf2()));
        //debug

/*
 * Debug.Log("deltalat = " + deltalat);
 * Debug.Log("x0 = "+ ve.getX0());
 * Debug.Log("y0 = " + ve.getY0());
 * Debug.Log("d = " + (ve.getDeclination() / Math.PI * 180.0));
 * Debug.Log("l1 = " + ve.getL1());
 * Debug.Log("l2 = " + ve.getL2());
 * Debug.Log("tanf1 = " + ve.getTanf1());
 * Debug.Log("tanf2 = " + ve.getTanf2());
 * Debug.Log("myu = " + myu);
 * Debug.Log("x = " + x);
 * Debug.Log("y = " + y);
 * Debug.Log("z = " + z);
 * Debug.Log("r = " + r);
 * Debug.Log("delta = " + delta);
 * Debug.Log("sinQ = " + sinQ);
 * Debug.Log("(x - x0)/ (y - y0) = " + (xdiff / ydiff));
 * Debug.Log("pais(x-x0)tan(d) / sin2 Q  = " + (0.0000426 * xdiff * Math.Tan(d) / (sinQ * sinQ)));
 * Debug.Log("Tan(phai) = " + tanphai);
 * Debug.Log("phai = " + moon_angle_to_northpole);
 * Debug.Log("x / y = " + (x / y));
 * Debug.Log("delta phai = " + (delta * latitude * r * x * Math.Cos(d) / (y * y * Math.Cos(latitude))));
 * Debug.Log("tan(nyu) = " + tannyu);
 * Debug.Log("nyu = " + zenith_angle_to_northpole);
 * Debug.Log("omega = " + omega);
 * Debug.Log("D=" + D);
 */
//debug終わり
    }