ICU-2424 remove statics, more cleanups, fix UMR
X-SVN-Rev: 13986
This commit is contained in:
parent
b4e7245d1e
commit
a0d543bcf3
@ -61,7 +61,7 @@ static inline UBool isINVALID(double d) {
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::SIDEREAL_DAY = 23.93446960027;
|
||||
#define SIDEREAL_DAY (23.93446960027)
|
||||
|
||||
/**
|
||||
* The number of sidereal hours in one mean solar day.
|
||||
@ -69,7 +69,7 @@ const double CalendarAstronomer::SIDEREAL_DAY = 23.93446960027;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::SOLAR_DAY = 24.065709816;
|
||||
#define SOLAR_DAY (24.065709816)
|
||||
|
||||
/**
|
||||
* The average number of solar days from one new moon to the next. This is the time
|
||||
@ -82,7 +82,7 @@ const double CalendarAstronomer::SOLAR_DAY = 24.065709816;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
|
||||
const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
|
||||
|
||||
/**
|
||||
* The average number of days it takes
|
||||
@ -96,7 +96,7 @@ const double CalendarAstronomer::SYNODIC_MONTH = 29.530588853;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::SIDEREAL_MONTH = 27.32166;
|
||||
#define SIDEREAL_MONTH 27.32166
|
||||
|
||||
/**
|
||||
* The average number number of days between successive vernal equinoxes.
|
||||
@ -108,7 +108,7 @@ const double CalendarAstronomer::SIDEREAL_MONTH = 27.32166;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::TROPICAL_YEAR = 365.242191;
|
||||
#define TROPICAL_YEAR 365.242191
|
||||
|
||||
/**
|
||||
* The average number of days it takes
|
||||
@ -123,7 +123,7 @@ const double CalendarAstronomer::TROPICAL_YEAR = 365.242191;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::SIDEREAL_YEAR = 365.25636;
|
||||
#define SIDEREAL_YEAR 365.25636
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Time-related constants
|
||||
@ -134,28 +134,28 @@ const double CalendarAstronomer::SIDEREAL_YEAR = 365.25636;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const int32_t CalendarAstronomer::SECOND_MS = 1000;
|
||||
#define SECOND_MS U_MILLIS_PER_SECOND
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one minute.
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const int32_t CalendarAstronomer::MINUTE_MS = 60*SECOND_MS;
|
||||
#define MINUTE_MS U_MILLIS_PER_MINUTE
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one hour.
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const int32_t CalendarAstronomer::HOUR_MS = 60*MINUTE_MS;
|
||||
#define HOUR_MS U_MILLIS_PER_HOUR
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one day.
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::DAY_MS = 24.*HOUR_MS;
|
||||
#define DAY_MS U_MILLIS_PER_DAY
|
||||
|
||||
/**
|
||||
* The start of the julian day numbering scheme used by astronomers, which
|
||||
@ -167,13 +167,13 @@ const double CalendarAstronomer::DAY_MS = 24.*HOUR_MS;
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const double CalendarAstronomer::JULIAN_EPOCH_MS = -210866760000000.0;
|
||||
#define JULIAN_EPOCH_MS -210866760000000.0
|
||||
|
||||
|
||||
/**
|
||||
* Milliseconds value for 0.0 January 2000 AD.
|
||||
*/
|
||||
const double CalendarAstronomer::EPOCH_2000_MS = 946598400000.0;
|
||||
#define EPOCH_2000_MS 946598400000.0
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Assorted private data used for conversions
|
||||
@ -181,10 +181,11 @@ const double CalendarAstronomer::EPOCH_2000_MS = 946598400000.0;
|
||||
|
||||
// My own copies of these so compilers are more likely to optimize them away
|
||||
const double CalendarAstronomer::PI = 3.14159265358979323846;
|
||||
const double CalendarAstronomer::PI2 = CalendarAstronomer::PI * 2.0;
|
||||
const double CalendarAstronomer::RAD_HOUR = 12 / CalendarAstronomer::PI; // radians -> hours
|
||||
const double CalendarAstronomer::DEG_RAD = CalendarAstronomer::PI / 180; // degrees -> radians
|
||||
const double CalendarAstronomer::RAD_DEG = 180 / CalendarAstronomer::PI; // radians -> degrees
|
||||
|
||||
#define CalendarAstronomer_PI2 (CalendarAstronomer::PI*2.0)
|
||||
#define RAD_HOUR ( 12 / CalendarAstronomer::PI ) // radians -> hours
|
||||
#define DEG_RAD ( CalendarAstronomer::PI / 180 ) // degrees -> radians
|
||||
#define RAD_DEG ( 180 / CalendarAstronomer::PI ) // radians -> degrees
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Constructors
|
||||
@ -197,7 +198,8 @@ const double CalendarAstronomer::RAD_DEG = 180 / CalendarAstronomer::PI;
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
CalendarAstronomer::CalendarAstronomer():
|
||||
fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(FALSE) {
|
||||
fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(FALSE), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0) {
|
||||
clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -206,7 +208,8 @@ CalendarAstronomer::CalendarAstronomer():
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d),moonPosition(0,0), moonPositionSet(FALSE) {
|
||||
CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d),moonPosition(0,0), moonPositionSet(FALSE), fLongitude(0.0), fLatitude(0.0), fGmtOffset(0.0) {
|
||||
clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,9 +229,10 @@ CalendarAstronomer::CalendarAstronomer(UDate d): fTime(d),moonPosition(0,0), moo
|
||||
*/
|
||||
CalendarAstronomer::CalendarAstronomer(double longitude, double latitude) :
|
||||
fTime(Calendar::getNow()), moonPosition(0,0), moonPositionSet(FALSE) {
|
||||
fLongitude = normPI(longitude * DEG_RAD);
|
||||
fLatitude = normPI(latitude * DEG_RAD);
|
||||
fGmtOffset = (double)(fLongitude * 24 * HOUR_MS / CalendarAstronomer::PI2);
|
||||
fLongitude = normPI(longitude * (double)DEG_RAD);
|
||||
fLatitude = normPI(latitude * (double)DEG_RAD);
|
||||
fGmtOffset = (double)(fLongitude * 24. * (double)HOUR_MS / (double)CalendarAstronomer_PI2);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
CalendarAstronomer::~CalendarAstronomer()
|
||||
@ -319,7 +323,7 @@ double CalendarAstronomer::getJulianDay() {
|
||||
*/
|
||||
double CalendarAstronomer::getJulianCentury() {
|
||||
if (isINVALID(julianCentury)) {
|
||||
julianCentury = (getJulianDay() - 2415020.0) / 36525;
|
||||
julianCentury = (getJulianDay() - 2415020.0) / 36525.0;
|
||||
}
|
||||
return julianCentury;
|
||||
}
|
||||
@ -334,9 +338,9 @@ double CalendarAstronomer::getGreenwichSidereal() {
|
||||
// See page 86 of "Practial Astronomy with your Calculator",
|
||||
// by Peter Duffet-Smith, for details on the algorithm.
|
||||
|
||||
double UT = normalize((double)fTime/HOUR_MS, 24);
|
||||
double UT = normalize(fTime/(double)HOUR_MS, 24.);
|
||||
|
||||
siderealTime = normalize(getSiderealOffset() + UT*1.002737909, 24);
|
||||
siderealTime = normalize(getSiderealOffset() + UT*1.002737909, 24.);
|
||||
}
|
||||
return siderealTime;
|
||||
}
|
||||
@ -357,7 +361,7 @@ double CalendarAstronomer::getSiderealOffset() {
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
double CalendarAstronomer::getLocalSidereal() {
|
||||
return normalize(getGreenwichSidereal() + (double)fGmtOffset/HOUR_MS, 24);
|
||||
return normalize(getGreenwichSidereal() + (fGmtOffset/(double)HOUR_MS), 24.);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,7 +378,7 @@ double CalendarAstronomer::lstToUT(double lst) {
|
||||
double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24);
|
||||
|
||||
// Then find local midnight on this day
|
||||
double base = (DAY_MS * Math::floorDivide(fTime + fGmtOffset,DAY_MS)) - fGmtOffset;
|
||||
double base = (DAY_MS * Math::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset;
|
||||
|
||||
//out(" lt =" + lt + " hours");
|
||||
//out(" base=" + new Date(base));
|
||||
@ -479,13 +483,13 @@ CalendarAstronomer::Horizon& CalendarAstronomer::eclipticToHorizon(CalendarAstro
|
||||
// Parameters of the Sun's orbit as of the epoch Jan 0.0 1990
|
||||
// Angles are in radians (after multiplying by CalendarAstronomer::PI/180)
|
||||
//
|
||||
const double CalendarAstronomer::JD_EPOCH = 2447891.5; // Julian day of epoch
|
||||
#define JD_EPOCH 2447891.5 // Julian day of epoch
|
||||
|
||||
const double CalendarAstronomer::SUN_ETA_G = 279.403303 * CalendarAstronomer::PI/180; // Ecliptic longitude at epoch
|
||||
const double CalendarAstronomer::SUN_OMEGA_G = 282.768422 * CalendarAstronomer::PI/180; // Ecliptic longitude of perigee
|
||||
const double CalendarAstronomer::SUN_E = 0.016713; // Eccentricity of orbit
|
||||
//double sunR0 = 1.495585e8; // Semi-major axis in KM
|
||||
//double sunTheta0 = 0.533128 * CalendarAstronomer::PI/180; // Angular diameter at R0
|
||||
#define SUN_ETA_G (279.403303 * CalendarAstronomer::PI/180) // Ecliptic longitude at epoch
|
||||
#define SUN_OMEGA_G (282.768422 * CalendarAstronomer::PI/180) // Ecliptic longitude of perigee
|
||||
#define SUN_E 0.016713 // Eccentricity of orbit
|
||||
//double sunR0 1.495585e8 // Semi-major axis in KM
|
||||
//double sunTheta0 (0.533128 * CalendarAstronomer::PI/180) // Angular diameter at R0
|
||||
|
||||
// The following three methods, which compute the sun parameters
|
||||
// given above for an arbitrary epoch (whatever time the object is
|
||||
@ -567,7 +571,7 @@ double CalendarAstronomer::getSunLongitude()
|
||||
|
||||
// Find the angular distance the sun in a fictitious
|
||||
// circular orbit has travelled since the epoch.
|
||||
double epochAngle = norm2PI(PI2/TROPICAL_YEAR*day);
|
||||
double epochAngle = norm2PI(CalendarAstronomer_PI2/TROPICAL_YEAR*day);
|
||||
|
||||
// The epoch wasn't at the sun's perigee; find the angular distance
|
||||
// since perigee, which is called the "mean anomaly"
|
||||
@ -598,7 +602,9 @@ CalendarAstronomer::Equatorial& CalendarAstronomer::getSunPosition(CalendarAstro
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::SolarLongitude CalendarAstronomer::VERNAL_EQUINOX = CalendarAstronomer::SolarLongitude(0);
|
||||
double CalendarAstronomer::VERNAL_EQUINOX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant representing the summer solstice.
|
||||
@ -607,7 +613,9 @@ const CalendarAstronomer::SolarLongitude CalendarAstronomer::VERNAL_EQUINOX =
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::SolarLongitude CalendarAstronomer::SUMMER_SOLSTICE = CalendarAstronomer::SolarLongitude(PI/2);
|
||||
double CalendarAstronomer::SUMMER_SOLSTICE() {
|
||||
return (CalendarAstronomer::PI/2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant representing the autumnal equinox.
|
||||
@ -616,7 +624,9 @@ const CalendarAstronomer::SolarLongitude CalendarAstronomer::SUMMER_SOLSTICE =
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::SolarLongitude CalendarAstronomer::AUTUMN_EQUINOX = CalendarAstronomer::SolarLongitude(PI);
|
||||
double CalendarAstronomer::AUTUMN_EQUINOX() {
|
||||
return (CalendarAstronomer::PI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant representing the winter solstice.
|
||||
@ -625,7 +635,9 @@ const CalendarAstronomer::SolarLongitude CalendarAstronomer::AUTUMN_EQUINOX =
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::SolarLongitude CalendarAstronomer::WINTER_SOLSTICE = CalendarAstronomer::SolarLongitude((PI*3)/2);
|
||||
double CalendarAstronomer::WINTER_SOLSTICE() {
|
||||
return ((CalendarAstronomer::PI*3)/2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next time at which the sun's ecliptic longitude will have
|
||||
@ -648,16 +660,6 @@ UDate CalendarAstronomer::getSunTime(double desired, UBool next)
|
||||
next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next time at which the sun's ecliptic longitude will have
|
||||
* the desired value.
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
UDate CalendarAstronomer::getSunTime(const SolarLongitude& desired, UBool next) {
|
||||
return getSunTime(desired.value, next);
|
||||
}
|
||||
|
||||
class RiseSetCoordFunc : public CalendarAstronomer::CoordFunc {
|
||||
public:
|
||||
virtual void eval(CalendarAstronomer::Equatorial& result, CalendarAstronomer&a) { a.getSunPosition(result); }
|
||||
@ -668,7 +670,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
|
||||
UDate t0 = fTime;
|
||||
|
||||
// Make a rough guess: 6am or 6pm local time on the current day
|
||||
double noon = Math::floorDivide(fTime + fGmtOffset, DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);
|
||||
double noon = Math::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);
|
||||
|
||||
U_DEBUG_ASTRO_MSG(("Noon=%.2lf, %sL, gmtoff %.2lf\n", noon, debug_astro_date(noon+fGmtOffset), fGmtOffset));
|
||||
setTime(noon + ((rise ? -6 : 6) * HOUR_MS));
|
||||
@ -708,11 +710,11 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
|
||||
// // 3. Calculate LSTs of rising and setting for these two positions
|
||||
// double tanL = ::tan(fLatitude);
|
||||
// double H = ::acos(-tanL * ::tan(pos1.declination));
|
||||
// double lst1r = (PI2 + pos1.ascension - H) * 24 / CalendarAstronomer::PI2;
|
||||
// double lst1s = (pos1.ascension + H) * 24 / CalendarAstronomer::PI2;
|
||||
// double lst1r = (CalendarAstronomer_PI2 + pos1.ascension - H) * 24 / CalendarAstronomer_PI2;
|
||||
// double lst1s = (pos1.ascension + H) * 24 / CalendarAstronomer_PI2;
|
||||
// H = ::acos(-tanL * ::tan(pos2.declination));
|
||||
// double lst2r = (PI2-H + pos2.ascension ) * 24 / CalendarAstronomer::PI2;
|
||||
// double lst2s = (H + pos2.ascension ) * 24 / CalendarAstronomer::PI2;
|
||||
// double lst2r = (CalendarAstronomer_PI2-H + pos2.ascension ) * 24 / CalendarAstronomer_PI2;
|
||||
// double lst2s = (H + pos2.ascension ) * 24 / CalendarAstronomer_PI2;
|
||||
// if (lst1r > 24) lst1r -= 24;
|
||||
// if (lst1s > 24) lst1s -= 24;
|
||||
// if (lst2r > 24) lst2r -= 24;
|
||||
@ -774,7 +776,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
|
||||
// * @return GST in hours (0..24)
|
||||
// */
|
||||
// double lstToGst(double lst) {
|
||||
// double delta = fLongitude * 24 / CalendarAstronomer::PI2;
|
||||
// double delta = fLongitude * 24 / CalendarAstronomer_PI2;
|
||||
// return normalize(lst - delta, 24);
|
||||
// }
|
||||
|
||||
@ -961,16 +963,16 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise)
|
||||
// The Moon
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
const double CalendarAstronomer::moonL0 = 318.351648 * CalendarAstronomer::PI/180; // Mean long. at epoch
|
||||
const double CalendarAstronomer::moonP0 = 36.340410 * CalendarAstronomer::PI/180; // Mean long. of perigee
|
||||
const double CalendarAstronomer::moonN0 = 318.510107 * CalendarAstronomer::PI/180; // Mean long. of node
|
||||
const double CalendarAstronomer::moonI = 5.145366 * CalendarAstronomer::PI/180; // Inclination of orbit
|
||||
const double CalendarAstronomer::moonE = 0.054900; // Eccentricity of orbit
|
||||
#define moonL0 (318.351648 * CalendarAstronomer::PI/180 ) // Mean long. at epoch
|
||||
#define moonP0 ( 36.340410 * CalendarAstronomer::PI/180 ) // Mean long. of perigee
|
||||
#define moonN0 ( 318.510107 * CalendarAstronomer::PI/180 ) // Mean long. of node
|
||||
#define moonI ( 5.145366 * CalendarAstronomer::PI/180 ) // Inclination of orbit
|
||||
#define moonE ( 0.054900 ) // Eccentricity of orbit
|
||||
|
||||
// These aren't used right now
|
||||
const double CalendarAstronomer::moonA = 3.84401e5; // semi-major axis (km)
|
||||
const double CalendarAstronomer::moonT0 = 0.5181 * CalendarAstronomer::PI/180; // Angular size at distance A
|
||||
const double CalendarAstronomer::moonPi = 0.9507 * CalendarAstronomer::PI/180; // Parallax at distance A
|
||||
#define moonA ( 3.84401e5 ) // semi-major axis (km)
|
||||
#define moonT0 ( 0.5181 * CalendarAstronomer::PI/180 ) // Angular size at distance A
|
||||
#define moonPi ( 0.9507 * CalendarAstronomer::PI/180 ) // Parallax at distance A
|
||||
|
||||
/**
|
||||
* The position of the moon at the time set on this
|
||||
@ -1107,7 +1109,9 @@ double CalendarAstronomer::getMoonPhase() {
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON = CalendarAstronomer::MoonAge(0);
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON() {
|
||||
return CalendarAstronomer::MoonAge(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant representing the moon's first quarter.
|
||||
@ -1115,7 +1119,9 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::NEW_MOON = CalendarA
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER = CalendarAstronomer::MoonAge(CalendarAstronomer::PI/2);
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER() {
|
||||
return CalendarAstronomer::MoonAge(CalendarAstronomer::PI/2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant representing a full moon.
|
||||
@ -1123,8 +1129,9 @@ const CalendarAstronomer::MoonAge CalendarAstronomer::FIRST_QUARTER = CalendarA
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::FULL_MOON = CalendarAstronomer::MoonAge(CalendarAstronomer::PI);
|
||||
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::FULL_MOON() {
|
||||
return CalendarAstronomer::MoonAge(CalendarAstronomer::PI);
|
||||
}
|
||||
/**
|
||||
* Constant representing the moon's last quarter.
|
||||
* For use with {@link #getMoonTime getMoonTime}
|
||||
@ -1137,7 +1144,9 @@ public:
|
||||
virtual double eval(CalendarAstronomer&a) { return a.getMoonAge(); }
|
||||
};
|
||||
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER = CalendarAstronomer::MoonAge((CalendarAstronomer::PI*3)/2);
|
||||
const CalendarAstronomer::MoonAge CalendarAstronomer::LAST_QUARTER() {
|
||||
return CalendarAstronomer::MoonAge((CalendarAstronomer::PI*3)/2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next or previous time at which the Moon's ecliptic
|
||||
@ -1209,7 +1218,7 @@ UDate CalendarAstronomer::timeOfAngle(AngleFunc& func, double desired,
|
||||
|
||||
// Using the average period, estimate the next (or previous) time at
|
||||
// which the desired angle occurs.
|
||||
double deltaT = (deltaAngle + (next ? 0.0 : -CalendarAstronomer::PI2)) * (periodDays*CalendarAstronomer::DAY_MS) / CalendarAstronomer::PI2;
|
||||
double deltaT = (deltaAngle + (next ? 0.0 : - CalendarAstronomer_PI2 )) * (periodDays*DAY_MS) / CalendarAstronomer_PI2;
|
||||
|
||||
double lastDeltaT = deltaT; // Liu
|
||||
UDate startTime = fTime; // Liu
|
||||
@ -1286,7 +1295,7 @@ UDate CalendarAstronomer::riseOrSet(CoordFunc& func, UBool rise,
|
||||
// See "Practical Astronomy With Your Calculator, section 33.
|
||||
func.eval(pos, *this);
|
||||
double angle = ::acos(-tanL * ::tan(pos.declination));
|
||||
double lst = ((rise ? CalendarAstronomer::PI2-angle : angle) + pos.ascension ) * 24 / CalendarAstronomer::PI2;
|
||||
double lst = ((rise ? CalendarAstronomer_PI2-angle : angle) + pos.ascension ) * 24 / CalendarAstronomer_PI2;
|
||||
|
||||
// Convert from LST to Universal Time.
|
||||
UDate newTime = lstToUT( lst );
|
||||
|
@ -259,22 +259,12 @@ public:
|
||||
|
||||
public:
|
||||
//-------------------------------------------------------------------------
|
||||
// Astronomical constants
|
||||
// Assorted private data used for conversions
|
||||
//-------------------------------------------------------------------------
|
||||
/**
|
||||
* The number of standard hours in one sidereal day.
|
||||
* Approximately 24.93.
|
||||
* @internal
|
||||
*/
|
||||
static const double SIDEREAL_DAY;
|
||||
|
||||
/**
|
||||
* The number of sidereal hours in one mean solar day.
|
||||
* Approximately 24.07.
|
||||
* @internal
|
||||
*/
|
||||
static const double SOLAR_DAY;
|
||||
|
||||
|
||||
// My own copies of these so compilers are more likely to optimize them away
|
||||
static const double PI;
|
||||
|
||||
/**
|
||||
* The average number of solar days from one new moon to the next. This is the time
|
||||
* it takes for the moon to return the same ecliptic longitude as the sun.
|
||||
@ -284,121 +274,10 @@ public:
|
||||
*
|
||||
* @see #SIDEREAL_MONTH
|
||||
* @internal
|
||||
* @deprecated ICU 2.4. This class may be removed or modified.
|
||||
*/
|
||||
static const double SYNODIC_MONTH;
|
||||
|
||||
/**
|
||||
* The average number of days it takes
|
||||
* for the moon to return to the same ecliptic longitude relative to the
|
||||
* stellar background. This is referred to as the sidereal month.
|
||||
* It is shorter than the synodic month due to
|
||||
* the revolution of the earth around the sun.
|
||||
* Approximately 27.32.
|
||||
*
|
||||
* @see #SYNODIC_MONTH
|
||||
* @internal
|
||||
*/
|
||||
static const double SIDEREAL_MONTH;
|
||||
|
||||
/**
|
||||
* The average number number of days between successive vernal equinoxes.
|
||||
* Due to the precession of the earth's
|
||||
* axis, this is not precisely the same as the sidereal year.
|
||||
* Approximately 365.24
|
||||
*
|
||||
* @see #SIDEREAL_YEAR
|
||||
* @internal
|
||||
*/
|
||||
static const double TROPICAL_YEAR;
|
||||
|
||||
/**
|
||||
* The average number of days it takes
|
||||
* for the sun to return to the same position against the fixed stellar
|
||||
* background. This is the duration of one orbit of the earth about the sun
|
||||
* as it would appear to an outside observer.
|
||||
* Due to the precession of the earth's
|
||||
* axis, this is not precisely the same as the tropical year.
|
||||
* Approximately 365.25.
|
||||
*
|
||||
* @see #TROPICAL_YEAR
|
||||
* @internal
|
||||
*/
|
||||
static const double SIDEREAL_YEAR;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Time-related constants
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one second.
|
||||
* @internal
|
||||
*/
|
||||
static const int32_t SECOND_MS;
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one minute.
|
||||
* @internal
|
||||
*/
|
||||
static const int32_t MINUTE_MS;
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one hour.
|
||||
* @internal
|
||||
*/
|
||||
static const int32_t HOUR_MS;
|
||||
|
||||
/**
|
||||
* The number of milliseconds in one day.
|
||||
* @internal
|
||||
*/
|
||||
static const double DAY_MS;
|
||||
|
||||
/**
|
||||
* The start of the julian day numbering scheme used by astronomers, which
|
||||
* is 1/1/4713 BC (Julian), 12:00 GMT. This is given as the number of milliseconds
|
||||
* since 1/1/1970 AD (Gregorian), a negative number.
|
||||
* Note that julian day numbers and
|
||||
* the Julian calendar are <em>not</em> the same thing. Also note that
|
||||
* julian days start at <em>noon</em>, not midnight.
|
||||
* @internal
|
||||
*/
|
||||
static const double JULIAN_EPOCH_MS;
|
||||
|
||||
// static {
|
||||
// Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
// cal.clear();
|
||||
// cal.set(cal.ERA, 0);
|
||||
// cal.set(cal.YEAR, 4713);
|
||||
// cal.set(cal.MONTH, cal.JANUARY);
|
||||
// cal.set(cal.DATE, 1);
|
||||
// cal.set(cal.HOUR_OF_DAY, 12);
|
||||
// System.out.println("1.5 Jan 4713 BC = " + cal.getTime().getTime());
|
||||
|
||||
// cal.clear();
|
||||
// cal.set(cal.YEAR, 2000);
|
||||
// cal.set(cal.MONTH, cal.JANUARY);
|
||||
// cal.set(cal.DATE, 1);
|
||||
// cal.add(cal.DATE, -1);
|
||||
// System.out.println("0.0 Jan 2000 = " + cal.getTime().getTime());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Milliseconds value for 0.0 January 2000 AD.
|
||||
*/
|
||||
static const double EPOCH_2000_MS;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Assorted private data used for conversions
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// My own copies of these so compilers are more likely to optimize them away
|
||||
static const double PI;
|
||||
static const double PI2;
|
||||
|
||||
static const double RAD_HOUR;
|
||||
static const double DEG_RAD;
|
||||
static const double RAD_DEG;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Constructors
|
||||
//-------------------------------------------------------------------------
|
||||
@ -583,63 +462,6 @@ public:
|
||||
// The Sun
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Parameters of the Sun's orbit as of the epoch Jan 0.0 1990
|
||||
// Angles are in radians (after multiplying by PI/180)
|
||||
//
|
||||
static const double JD_EPOCH;
|
||||
|
||||
static const double SUN_ETA_G;
|
||||
static const double SUN_OMEGA_G;
|
||||
static const double SUN_E ;
|
||||
//double sunR0 = 1.495585e8; // Semi-major axis in KM
|
||||
//double sunTheta0 = 0.533128 * PI/180; // Angular diameter at R0
|
||||
|
||||
// The following three methods, which compute the sun parameters
|
||||
// given above for an arbitrary epoch (whatever time the object is
|
||||
// set to), make only a small difference as compared to using the
|
||||
// above constants. E.g., Sunset times might differ by ~12
|
||||
// seconds. Furthermore, the eta-g computation is befuddled by
|
||||
// Duffet-Smith's incorrect coefficients (p.86). I've corrected
|
||||
// the first-order coefficient but the others may be off too - no
|
||||
// way of knowing without consulting another source.
|
||||
|
||||
// /**
|
||||
// * Return the sun's ecliptic longitude at perigee for the current time.
|
||||
// * See Duffett-Smith, p. 86.
|
||||
// * @return radians
|
||||
// */
|
||||
// private double getSunOmegaG() {
|
||||
// double T = getJulianCentury();
|
||||
// return (281.2208444 + (1.719175 + 0.000452778*T)*T) * DEG_RAD;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Return the sun's ecliptic longitude for the current time.
|
||||
// * See Duffett-Smith, p. 86.
|
||||
// * @return radians
|
||||
// */
|
||||
// private double getSunEtaG() {
|
||||
// double T = getJulianCentury();
|
||||
// //return (279.6966778 + (36000.76892 + 0.0003025*T)*T) * DEG_RAD;
|
||||
// //
|
||||
// // The above line is from Duffett-Smith, and yields manifestly wrong
|
||||
// // results. The below constant is derived empirically to match the
|
||||
// // constant he gives for the 1990 EPOCH.
|
||||
// //
|
||||
// return (279.6966778 + (-0.3262541582718024 + 0.0003025*T)*T) * DEG_RAD;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Return the sun's eccentricity of orbit for the current time.
|
||||
// * See Duffett-Smith, p. 86.
|
||||
// * @return double
|
||||
// */
|
||||
// private double getSunE() {
|
||||
// double T = getJulianCentury();
|
||||
// return 0.01675104 - (0.0000418 + 0.000000126*T)*T;
|
||||
// }
|
||||
|
||||
/**
|
||||
* The longitude of the sun at the time specified by this object.
|
||||
* The longitude is measured in radians along the ecliptic
|
||||
@ -666,15 +488,6 @@ public:
|
||||
*/
|
||||
Equatorial& getSunPosition(Equatorial& result);
|
||||
|
||||
public:
|
||||
class U_I18N_API SolarLongitude : public UMemory {
|
||||
public:
|
||||
SolarLongitude(double l)
|
||||
: value(l) { }
|
||||
void set(double l) { value = l; }
|
||||
double value;
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constant representing the vernal equinox.
|
||||
@ -682,7 +495,7 @@ public:
|
||||
* Note: In this case, "vernal" refers to the northern hemisphere's seasons.
|
||||
* @internal
|
||||
*/
|
||||
static const SolarLongitude VERNAL_EQUINOX;
|
||||
static double VERNAL_EQUINOX();
|
||||
|
||||
/**
|
||||
* Constant representing the summer solstice.
|
||||
@ -690,7 +503,7 @@ public:
|
||||
* Note: In this case, "summer" refers to the northern hemisphere's seasons.
|
||||
* @internal
|
||||
*/
|
||||
static const SolarLongitude SUMMER_SOLSTICE;
|
||||
static double SUMMER_SOLSTICE();
|
||||
|
||||
/**
|
||||
* Constant representing the autumnal equinox.
|
||||
@ -698,7 +511,7 @@ public:
|
||||
* Note: In this case, "autumn" refers to the northern hemisphere's seasons.
|
||||
* @internal
|
||||
*/
|
||||
static const SolarLongitude AUTUMN_EQUINOX;
|
||||
static double AUTUMN_EQUINOX();
|
||||
|
||||
/**
|
||||
* Constant representing the winter solstice.
|
||||
@ -706,20 +519,14 @@ public:
|
||||
* Note: In this case, "winter" refers to the northern hemisphere's seasons.
|
||||
* @internal
|
||||
*/
|
||||
static const SolarLongitude WINTER_SOLSTICE;
|
||||
static double WINTER_SOLSTICE();
|
||||
|
||||
/**
|
||||
* Find the next time at which the sun's ecliptic longitude will have
|
||||
* the desired value.
|
||||
* @internal
|
||||
*/
|
||||
UDate getSunTime(UDate desired, UBool next);
|
||||
/**
|
||||
* Find the next time at which the sun's ecliptic longitude will have
|
||||
* the desired value.
|
||||
* @internal
|
||||
*/
|
||||
UDate getSunTime(const SolarLongitude& desired, UBool next);
|
||||
UDate getSunTime(double desired, UBool next);
|
||||
|
||||
/**
|
||||
* Returns the time (GMT) of sunrise or sunset on the local date to which
|
||||
@ -735,294 +542,10 @@ public:
|
||||
*/
|
||||
UDate getSunRiseSet(UBool rise);
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// //-------------------------------------------------------------------------
|
||||
// // Alternate Sun Rise/Set
|
||||
// // See Duffett-Smith p.93
|
||||
// //-------------------------------------------------------------------------
|
||||
//
|
||||
// // This yields worse results (as compared to USNO data) than getSunRiseSet().
|
||||
// /**
|
||||
// * TODO Make this public when the entire class is package-private.
|
||||
// */
|
||||
// /*public*/ long getSunRiseSet2(boolean rise) {
|
||||
// // 1. Calculate coordinates of the sun's center for midnight
|
||||
// double jd = Math.floor(getJulianDay() - 0.5) + 0.5;
|
||||
// double[] sl = getSunLongitude(jd);
|
||||
// double lambda1 = sl[0];
|
||||
// Equatorial pos1 = eclipticToEquatorial(lambda1, 0);
|
||||
//
|
||||
// // 2. Add ... to lambda to get position 24 hours later
|
||||
// double lambda2 = lambda1 + 0.985647*DEG_RAD;
|
||||
// Equatorial pos2 = eclipticToEquatorial(lambda2, 0);
|
||||
//
|
||||
// // 3. Calculate LSTs of rising and setting for these two positions
|
||||
// double tanL = Math.tan(fLatitude);
|
||||
// double H = Math.acos(-tanL * Math.tan(pos1.declination));
|
||||
// double lst1r = (PI2 + pos1.ascension - H) * 24 / PI2;
|
||||
// double lst1s = (pos1.ascension + H) * 24 / PI2;
|
||||
// H = Math.acos(-tanL * Math.tan(pos2.declination));
|
||||
// double lst2r = (PI2-H + pos2.ascension ) * 24 / PI2;
|
||||
// double lst2s = (H + pos2.ascension ) * 24 / PI2;
|
||||
// if (lst1r > 24) lst1r -= 24;
|
||||
// if (lst1s > 24) lst1s -= 24;
|
||||
// if (lst2r > 24) lst2r -= 24;
|
||||
// if (lst2s > 24) lst2s -= 24;
|
||||
//
|
||||
// // 4. Convert LSTs to GSTs. If GST1 > GST2, add 24 to GST2.
|
||||
// double gst1r = lstToGst(lst1r);
|
||||
// double gst1s = lstToGst(lst1s);
|
||||
// double gst2r = lstToGst(lst2r);
|
||||
// double gst2s = lstToGst(lst2s);
|
||||
// if (gst1r > gst2r) gst2r += 24;
|
||||
// if (gst1s > gst2s) gst2s += 24;
|
||||
//
|
||||
// // 5. Calculate GST at 0h UT of this date
|
||||
// double t00 = utToGst(0);
|
||||
//
|
||||
// // 6. Calculate GST at 0h on the observer's longitude
|
||||
// double offset = Math.round(fLongitude*12/PI); // p.95 step 6; he _rounds_ to nearest 15 deg.
|
||||
// double t00p = t00 - offset*1.002737909;
|
||||
// if (t00p < 0) t00p += 24; // do NOT normalize
|
||||
//
|
||||
// // 7. Adjust
|
||||
// if (gst1r < t00p) {
|
||||
// gst1r += 24;
|
||||
// gst2r += 24;
|
||||
// }
|
||||
// if (gst1s < t00p) {
|
||||
// gst1s += 24;
|
||||
// gst2s += 24;
|
||||
// }
|
||||
//
|
||||
// // 8.
|
||||
// double gstr = (24.07*gst1r-t00*(gst2r-gst1r))/(24.07+gst1r-gst2r);
|
||||
// double gsts = (24.07*gst1s-t00*(gst2s-gst1s))/(24.07+gst1s-gst2s);
|
||||
//
|
||||
// // 9. Correct for parallax, refraction, and sun's diameter
|
||||
// double dec = (pos1.declination + pos2.declination) / 2;
|
||||
// double psi = Math.acos(Math.sin(fLatitude) / Math.cos(dec));
|
||||
// double x = 0.830725 * DEG_RAD; // parallax+refraction+diameter
|
||||
// double y = Math.asin(Math.sin(x) / Math.sin(psi)) * RAD_DEG;
|
||||
// double delta_t = 240 * y / Math.cos(dec) / 3600; // hours
|
||||
//
|
||||
// // 10. Add correction to GSTs, subtract from GSTr
|
||||
// gstr -= delta_t;
|
||||
// gsts += delta_t;
|
||||
//
|
||||
// // 11. Convert GST to UT and then to local civil time
|
||||
// double ut = gstToUt(rise ? gstr : gsts);
|
||||
// //System.out.println((rise?"rise=":"set=") + ut + ", delta_t=" + delta_t);
|
||||
// long midnight = DAY_MS * (time / DAY_MS); // Find UT midnight on this day
|
||||
// return midnight + (long) (ut * 3600000);
|
||||
// }
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// /**
|
||||
// * Convert local sidereal time to Greenwich sidereal time.
|
||||
// * Section 15. Duffett-Smith p.21
|
||||
// * @param lst in hours (0..24)
|
||||
// * @return GST in hours (0..24)
|
||||
// */
|
||||
// double lstToGst(double lst) {
|
||||
// double delta = fLongitude * 24 / PI2;
|
||||
// return normalize(lst - delta, 24);
|
||||
// }
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// /**
|
||||
// * Convert UT to GST on this date.
|
||||
// * Section 12. Duffett-Smith p.17
|
||||
// * @param ut in hours
|
||||
// * @return GST in hours
|
||||
// */
|
||||
// double utToGst(double ut) {
|
||||
// return normalize(getT0() + ut*1.002737909, 24);
|
||||
// }
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// /**
|
||||
// * Convert GST to UT on this date.
|
||||
// * Section 13. Duffett-Smith p.18
|
||||
// * @param gst in hours
|
||||
// * @return UT in hours
|
||||
// */
|
||||
// double gstToUt(double gst) {
|
||||
// return normalize(gst - getT0(), 24) * 0.9972695663;
|
||||
// }
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// double getT0() {
|
||||
// // Common computation for UT <=> GST
|
||||
//
|
||||
// // Find JD for 0h UT
|
||||
// double jd = Math.floor(getJulianDay() - 0.5) + 0.5;
|
||||
//
|
||||
// double s = jd - 2451545.0;
|
||||
// double t = s / 36525.0;
|
||||
// double t0 = 6.697374558 + (2400.051336 + 0.000025862*t)*t;
|
||||
// return t0;
|
||||
// }
|
||||
|
||||
// Commented out - currently unused. ICU 2.6, Alan
|
||||
// //-------------------------------------------------------------------------
|
||||
// // Alternate Sun Rise/Set
|
||||
// // See sci.astro FAQ
|
||||
// // http://www.faqs.org/faqs/astronomy/faq/part3/section-5.html
|
||||
// //-------------------------------------------------------------------------
|
||||
//
|
||||
// // Note: This method appears to produce inferior accuracy as
|
||||
// // compared to getSunRiseSet().
|
||||
//
|
||||
// /**
|
||||
// * TODO Make this public when the entire class is package-private.
|
||||
// */
|
||||
// /*public*/ long getSunRiseSet3(boolean rise) {
|
||||
//
|
||||
// // Compute day number for 0.0 Jan 2000 epoch
|
||||
// double d = (double)(time - EPOCH_2000_MS) / DAY_MS;
|
||||
//
|
||||
// // Now compute the Local Sidereal Time, LST:
|
||||
// //
|
||||
// double LST = 98.9818 + 0.985647352 * d + /*UT*15 + long*/
|
||||
// fLongitude*RAD_DEG;
|
||||
// //
|
||||
// // (east long. positive). Note that LST is here expressed in degrees,
|
||||
// // where 15 degrees corresponds to one hour. Since LST really is an angle,
|
||||
// // it's convenient to use one unit---degrees---throughout.
|
||||
//
|
||||
// // COMPUTING THE SUN'S POSITION
|
||||
// // ----------------------------
|
||||
// //
|
||||
// // To be able to compute the Sun's rise/set times, you need to be able to
|
||||
// // compute the Sun's position at any time. First compute the "day
|
||||
// // number" d as outlined above, for the desired moment. Next compute:
|
||||
// //
|
||||
// double oblecl = 23.4393 - 3.563E-7 * d;
|
||||
// //
|
||||
// double w = 282.9404 + 4.70935E-5 * d;
|
||||
// double M = 356.0470 + 0.9856002585 * d;
|
||||
// double e = 0.016709 - 1.151E-9 * d;
|
||||
// //
|
||||
// // This is the obliquity of the ecliptic, plus some of the elements of
|
||||
// // the Sun's apparent orbit (i.e., really the Earth's orbit): w =
|
||||
// // argument of perihelion, M = mean anomaly, e = eccentricity.
|
||||
// // Semi-major axis is here assumed to be exactly 1.0 (while not strictly
|
||||
// // true, this is still an accurate approximation). Next compute E, the
|
||||
// // eccentric anomaly:
|
||||
// //
|
||||
// double E = M + e*(180/PI) * Math.sin(M*DEG_RAD) * ( 1.0 + e*Math.cos(M*DEG_RAD) );
|
||||
// //
|
||||
// // where E and M are in degrees. This is it---no further iterations are
|
||||
// // needed because we know e has a sufficiently small value. Next compute
|
||||
// // the true anomaly, v, and the distance, r:
|
||||
// //
|
||||
// /* r * cos(v) = */ double A = Math.cos(E*DEG_RAD) - e;
|
||||
// /* r * sin(v) = */ double B = Math.sqrt(1 - e*e) * Math.sin(E*DEG_RAD);
|
||||
// //
|
||||
// // and
|
||||
// //
|
||||
// // r = sqrt( A*A + B*B )
|
||||
// double v = Math.atan2( B, A )*RAD_DEG;
|
||||
// //
|
||||
// // The Sun's true longitude, slon, can now be computed:
|
||||
// //
|
||||
// double slon = v + w;
|
||||
// //
|
||||
// // Since the Sun is always at the ecliptic (or at least very very close to
|
||||
// // it), we can use simplified formulae to convert slon (the Sun's ecliptic
|
||||
// // longitude) to sRA and sDec (the Sun's RA and Dec):
|
||||
// //
|
||||
// // sin(slon) * cos(oblecl)
|
||||
// // tan(sRA) = -------------------------
|
||||
// // cos(slon)
|
||||
// //
|
||||
// // sin(sDec) = sin(oblecl) * sin(slon)
|
||||
// //
|
||||
// // As was the case when computing az, the Azimuth, if possible use an
|
||||
// // atan2() function to compute sRA.
|
||||
//
|
||||
// double sRA = Math.atan2(Math.sin(slon*DEG_RAD) * Math.cos(oblecl*DEG_RAD), Math.cos(slon*DEG_RAD))*RAD_DEG;
|
||||
//
|
||||
// double sin_sDec = Math.sin(oblecl*DEG_RAD) * Math.sin(slon*DEG_RAD);
|
||||
// double sDec = Math.asin(sin_sDec)*RAD_DEG;
|
||||
//
|
||||
// // COMPUTING RISE AND SET TIMES
|
||||
// // ----------------------------
|
||||
// //
|
||||
// // To compute when an object rises or sets, you must compute when it
|
||||
// // passes the meridian and the HA of rise/set. Then the rise time is
|
||||
// // the meridian time minus HA for rise/set, and the set time is the
|
||||
// // meridian time plus the HA for rise/set.
|
||||
// //
|
||||
// // To find the meridian time, compute the Local Sidereal Time at 0h local
|
||||
// // time (or 0h UT if you prefer to work in UT) as outlined above---name
|
||||
// // that quantity LST0. The Meridian Time, MT, will now be:
|
||||
// //
|
||||
// // MT = RA - LST0
|
||||
// double MT = normalize(sRA - LST, 360);
|
||||
// //
|
||||
// // where "RA" is the object's Right Ascension (in degrees!). If negative,
|
||||
// // add 360 deg to MT. If the object is the Sun, leave the time as it is,
|
||||
// // but if it's stellar, multiply MT by 365.2422/366.2422, to convert from
|
||||
// // sidereal to solar time. Now, compute HA for rise/set, name that
|
||||
// // quantity HA0:
|
||||
// //
|
||||
// // sin(h0) - sin(lat) * sin(Dec)
|
||||
// // cos(HA0) = ---------------------------------
|
||||
// // cos(lat) * cos(Dec)
|
||||
// //
|
||||
// // where h0 is the altitude selected to represent rise/set. For a purely
|
||||
// // mathematical horizon, set h0 = 0 and simplify to:
|
||||
// //
|
||||
// // cos(HA0) = - tan(lat) * tan(Dec)
|
||||
// //
|
||||
// // If you want to account for refraction on the atmosphere, set h0 = -35/60
|
||||
// // degrees (-35 arc minutes), and if you want to compute the rise/set times
|
||||
// // for the Sun's upper limb, set h0 = -50/60 (-50 arc minutes).
|
||||
// //
|
||||
// double h0 = -50/60 * DEG_RAD;
|
||||
//
|
||||
// double HA0 = Math.acos(
|
||||
// (Math.sin(h0) - Math.sin(fLatitude) * sin_sDec) /
|
||||
// (Math.cos(fLatitude) * Math.cos(sDec*DEG_RAD)))*RAD_DEG;
|
||||
//
|
||||
// // When HA0 has been computed, leave it as it is for the Sun but multiply
|
||||
// // by 365.2422/366.2422 for stellar objects, to convert from sidereal to
|
||||
// // solar time. Finally compute:
|
||||
// //
|
||||
// // Rise time = MT - HA0
|
||||
// // Set time = MT + HA0
|
||||
// //
|
||||
// // convert the times from degrees to hours by dividing by 15.
|
||||
// //
|
||||
// // If you'd like to check that your calculations are accurate or just
|
||||
// // need a quick result, check the USNO's Sun or Moon Rise/Set Table,
|
||||
// // <URL:http://aa.usno.navy.mil/AA/data/docs/RS_OneYear.html>.
|
||||
//
|
||||
// double result = MT + (rise ? -HA0 : HA0); // in degrees
|
||||
//
|
||||
// // Find UT midnight on this day
|
||||
// long midnight = DAY_MS * (time / DAY_MS);
|
||||
//
|
||||
// return midnight + (long) (result * 3600000 / 15);
|
||||
// }
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// The Moon
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
static const double moonL0; // Mean long. at epoch
|
||||
static const double moonP0; // Mean long. of perigee
|
||||
static const double moonN0; // Mean long. of node
|
||||
static const double moonI; // Inclination of orbit
|
||||
static const double moonE; // Eccentricity of orbit
|
||||
|
||||
// These aren't used right now
|
||||
static const double moonA; // semi-major axis (km)
|
||||
static const double moonT0; // Angular size at distance A
|
||||
static const double moonPi; // Parallax at distance A
|
||||
|
||||
|
||||
/**
|
||||
* The position of the moon at the time set on this
|
||||
* object, in equatorial coordinates.
|
||||
@ -1071,28 +594,28 @@ public:
|
||||
* For use with {@link #getMoonTime getMoonTime}
|
||||
* @internal
|
||||
*/
|
||||
static const MoonAge NEW_MOON;
|
||||
static const MoonAge NEW_MOON();
|
||||
|
||||
/**
|
||||
* Constant representing the moon's first quarter.
|
||||
* For use with {@link #getMoonTime getMoonTime}
|
||||
* @internal
|
||||
*/
|
||||
static const MoonAge FIRST_QUARTER;
|
||||
static const MoonAge FIRST_QUARTER();
|
||||
|
||||
/**
|
||||
* Constant representing a full moon.
|
||||
* For use with {@link #getMoonTime getMoonTime}
|
||||
* @internal
|
||||
*/
|
||||
static const MoonAge FULL_MOON;
|
||||
static const MoonAge FULL_MOON();
|
||||
|
||||
/**
|
||||
* Constant representing the moon's last quarter.
|
||||
* For use with {@link #getMoonTime getMoonTime}
|
||||
* @internal
|
||||
*/
|
||||
static const MoonAge LAST_QUARTER;
|
||||
static const MoonAge LAST_QUARTER();
|
||||
|
||||
/**
|
||||
* Find the next or previous time at which the Moon's ecliptic
|
||||
@ -1155,14 +678,14 @@ private:
|
||||
* mod operator doesn't work that way for negative numbers....
|
||||
*/
|
||||
inline static double norm2PI(double angle) {
|
||||
return normalize(angle, PI2);
|
||||
return normalize(angle, CalendarAstronomer::PI * 2.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an angle into the range -PI - PI
|
||||
*/
|
||||
inline static double normPI(double angle) {
|
||||
return normalize(angle + PI, PI2) - PI;
|
||||
return normalize(angle + PI, CalendarAstronomer::PI * 2.0) - PI;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1229,18 +752,6 @@ private:
|
||||
Equatorial moonPosition;
|
||||
UBool moonPositionSet;
|
||||
|
||||
//private static void out(String s) {
|
||||
// System.out.println(s);
|
||||
//}
|
||||
|
||||
//private static String deg(double rad) {
|
||||
// return Double.toString(rad * RAD_DEG);
|
||||
//}
|
||||
|
||||
//private static String hours(long ms) {
|
||||
// return Double.toString((double)ms / HOUR_MS) + " hours";
|
||||
//}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user