我想从另一个类中调用该函数(底部的代码),但我不确定如何从中提取下面的阶段。
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);
}
整个课程可以在下面的链接中找到