用天文方法计算二十四节气
##用天文方法计算二十四节气
参数jde是力学时时间,单位是儒略日,返回太阳地心视黄经,单位是度。
double CalcEarthObliquityNutation(double dt) {
double T = dt * 10; /*T是从J2000起算的儒略世纪数*/
double D,M,Mp,F,Omega;
GetEarthNutationParameter(dt, &D, &M, &Mp, &F, &Omega);
double resulte = 0.0 ;
for(int i = 0; i < sizeof(nutation) / sizeof(nutation[0]); i++)
{
double sita = nutation[i].D * D + nutation[i].M * M + nutation[i].Mp * Mp + nutation[i].F * F + nutation[i].omega * Omega;
resulte += (nutation[i].cosine1 + nutation[i].cosine2 * T ) * cos(sita);
}
/*先乘以章动表的系数 0.001,然后换算成度的单位*/
return resulte * 0.0001 / 3600.0;
}
double CalculateSolarTerms(int year, int angle) {
double lJD, rJD;
EstimateSTtimeScope(year, angle, lJD, rJD); /*估算迭代起始时间区间*/
double solarTermsJD = 0.0;
double longitude = 0.0;
do
{
solarTermsJD = ((rJD - lJD) * 0.618) + lJD;
longitude = GetSunEclipticLongitudeECDegree(solarTermsJD);
/*
对黄经0度迭代逼近时,由于角度360度圆周性,估算黄经值可能在(345,360]和[0,15)两个区间,
如果值落入前一个区间,需要进行修正
*/
longitude = ((angle == 0) && (longitude > 345.0)) ? longitude - 360.0 : longitude;
(longitude > double(angle)) ? rJD = solarTermsJD : lJD = solarTermsJD;
}while((rJD - lJD) > 0.0000001);
return solarTermsJD;
}
本站文章除注明转载外,均为原创文章。转载请注明:文章转载自:
Zhazha(
http://bigqiang.com )