|
|
|
|
|
by jheriko
701 days ago
|
|
this looks incredibly bad from the implementation. there is a much simpler algorithm that works for hundreds of years in either direction of the present... by comparison this is an absolute mountain of code. here is a good one - but note that it is only so accurate for each quarter phase (...and not sure why it destroys the formatting): function approximateMoonPhase(julianDay) { // from Meeus p.319
// JDE = 2451 550.09765 + 29.530 588 853 k
// + 0.000 1337 T2
// - 0.000 000 150 T3
// + 0.000 000 000 73 T4
const t = toJulianCenturiesSinceJ2000(julianDay);
const lhs = julianDay - 2451550.09765 + (-0.0001337 + (0.00000015 - 0.00000000073 * t) * t) * t * t;
return lhs / 29.530588853;
}enjoy. its from the same source as your work appears to use... which, as someone who as implemented a ton of this stuff. its kind of a damning sentiment that we still refer to such an old book instead of learning the problem space and making better solutions... i have a whole book in me about this at some point. |
|
So it's not actually comparable at all?