I already did this in the Python code to significantly reduce the number
of calls to e_tilt(). Did the same thing here: call sidereal_time() once,
then use the value 3 times.
Also made minor optimizations to spin() function in both JS and C.
Fixed a mistake in JS and C that does not appear to have any
algorithmic consequences, but it was definitely confusing once I saw it.
Resolved FIXFIXFIX comments regarding whether or not to
correct for aberration. In all cases, the observations are
made from the Earth, in which case it makes the most sense
to correct for aberration.
I was using "relative longitude" to mean two different things.
Resolved the ambiguity by using relative longitude only for
differences in eclitpic longitude as seen from the Sun.
Use "ecliptic separation" for differences in ecliptic longitude
as measured from the Earth.
Fixed completely wrong documentation in the JavaScript code;
it had the meanings backwards inside the ElongationEvent class.
The following functions had parameters that accepted cryptic numeric values:
Astronomy_GeoVector
Astronomy_Equator
Astronomy_SearchRiseSet
Replaced such parameters with enumerations. Added the following enumerated types:
astro_aberration_t
astro_direction_t
astro_equator_date_t
Added more C documentation.
I made sure it is not possible to get stuck in an infinite
loop inside SearchLunarApsis, both the C and JavaScript versions.
If we loop over more time than 2 synodic months (more than enough time),
bail out with an exception (JS) or an internal error (C).
This is a refactoring to follow suit with what I did in the C
version of the code. It improves accuracy by using different
geocentric vector calculations for j2000 and ofdate equatorial
coordinates. Allow optional aberration corrections.
The C version of GeoPos was returning an ante-dated time value,
not the time the caller asked about. In other words, it was
returning the time when the observed body emitted the light
the observer sees, not the time the observation was made on the
Earth, like it was supposed to. Fortunately, my unit test caught that.