別のクラスから関数 (下部のコード) を呼び出したいのですが、そこから以下のフェーズを抽出する方法がわかりません。
phases[0]
phases[1]
phases[2]
phases[3]
phases[4]
これは私のコードではありません。他の人から入手しました。誰かがそれからフェーズを取得して画面に出力する方法を教えてくれることを願っています。
これまでのところ、次を使用して関数を呼び出しています
Phase phase = new Phase();
phase.phasehunt5(??);
コード:
/// Find time of phases of the moon which surround the current
// date. Five phases are found, starting and ending with the
// new moons which bound the current lunation.
public static void phasehunt5( double sdate, double[] phases )
{
double adate, nt1, nt2;
RefDouble k1 = new RefDouble();
RefDouble k2 = new RefDouble();
adate = sdate - 45;
nt1 = meanphase(adate, 0.0, k1);
for (;;)
{
adate += synmonth;
nt2 = meanphase(adate, 0.0, k2);
if (nt1 <= sdate && nt2 > sdate)
break;
nt1 = nt2;
k1.val = k2.val;
}
phases[0] = truephase(k1.val, 0.0);
phases[1] = truephase(k1.val, 0.25);
phases[2] = truephase(k1.val, 0.5);
phases[3] = truephase(k1.val, 0.75);
phases[4] = truephase(k2.val, 0.0);
}
クラス全体は、以下のリンクで見つけることができます