Commit Graph

12 Commits

Author SHA1 Message Date
Don Cross
42650bd341 Java: added true solar time demo 2023-02-12 20:01:05 -05:00
Don Cross
1a4f842764 Updated Ecliptic to return ECL in all languages. 2022-12-10 19:35:42 -05:00
Don Cross
8a153315cf Simplified and optimized nutation formula.
While trying to convert ecliptic coordinates from mean
equinox of date to true equinox of date, I ran into excessive
overhead from the IAU2000B nutation model. The fact that it
uses 77 trigonometric terms made the calculations a lot slower.

https://apps.dtic.mil/sti/pdfs/AD1112517.pdf
Page 4 in the above document mentions a shorter series
“NOD version 2” that has 13 terms instead of 77 as used in IAU2000B.
I had not noticed NOD2 before, because it appears only in
the FORTRAN version of NOVAS 3.x, not the C version.

After reading the FORTRAN code, I realized NOD2 is the same
as IAU2000B, only it keeps the first 13 of 77 terms.
The terms are already arranged in descending order of
significance, so it is easy to truncate the series.

Based on this discovery, I realized I could achieve all of
the required accuracy needed for Astronomy Engine by
keeping only the first 5 terms of the nutation series.
This tremendously speeds up nutation calculations while
sacrificing only a couple of arcseconds of accuracy.

It also makes the minified JavaScript code smaller:
Before: 119500 bytes.
After:  116653 bytes.

So that's what I did here. Most of the work was updating
unit tests for accepting slightly different calculation
results.

The nutation formula change did trigger detection of a
lurking bug in the inverse_terra functions, which convert
a geocentric vector into latitude, longitude, and elevation
(i.e. an Observer object). The Newton's Method loop in
this function was not always converging, resulting in
an infinite loop. I fixed that by increasing the
convergence threshold and throwing an exception
if the loop iterates more than 10 times.

I also fixed a couple of bugs in the `demotest` scripts.
2022-12-04 10:31:15 -05:00
Don Cross
61445889ad Forgot to update Java demo riseset.txt.
Changes to the altitude search caused a tiny
change in rise/set times in all the demo programs.
I remembered to update the expected output for
Kotlin, but forgot to do it for Java.
2022-11-14 07:52:46 -05:00
Don Cross
06b62887d2 Kotlin: obscuration for solar, lunar eclipses. 2022-10-20 17:31:21 -04:00
Don Cross
29e2bd31b8 Java demo: lunar eclipse prediction 2022-05-04 13:04:39 -04:00
Don Cross
7a916d4f8c Java demo: rise/set/culmination
Added Java demo to search for rise/set/culmination
of the Sun and Moon.

Also added the missing entry for the Kotlin
rise/set/culmination demo that I had forgotten.
2022-05-04 11:12:49 -04:00
Don Cross
f32a922ddb Demo for Kotlin, Java: constellation 2022-05-03 16:50:11 -04:00
Don Cross
1e84f4940f Demo jupiter_moons for Kotlin, Java.
Added Kotlin and Java demos for calculating Jupiter's moons.
Illustrates correcting for light travel time.
I added named getters for the 4 moons in `JupiterMoonsInfo`,
because in Java it was really ugly to write
`jm.getMoon()[0]`, etc.
2022-05-02 15:45:10 -04:00
Don Cross
190cc5b534 Java: added positions demo. 2022-05-01 21:12:57 -04:00
Don Cross
303bebdff5 Added Java demo for calculating seasons. 2022-04-30 21:20:33 -04:00
Don Cross
05684bafdb Kotlin: added Java demo: moonphase.
This is the first substantial demo of using
the Kotlin version of Astronomy Engine from
a Java program.

Structured the README.md so I can keep adding more and
more demos as separate Java class files.
The `demotest` script builds the code and will run
each demo one at a time, verifying each one's output.
2022-04-28 21:04:54 -04:00