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.
I had to add a new method `Vector.withTime` to work around
the error checking that throws an exception if vectors
from different times are added.
Also made Kotlin constants public:
MINUTES_PER_DAY
SECONDS_PER_DAY
MILLISECONDS_PER_DAY
Direct use of arrayOf can be a bit more efficient than calling map and toTypedArray.
It could be faster if JupiterMoonsInfo was holding a list but better to use direct
typed array initializer for more efficiency.
Used IntelliJ IDEA's linter to perform code cleanup.
There were unused variables, `var` that could be replaced with `val`,
and other minor code style issues.
While doing this, I also discovered that a lot of documentation
links were broken. The fix is to stop intenting the text after
a `@param`.
In anticipation of releasing the Kotlin version,
I set the version numbers for the following to 2.1.0:
Kotlin
Node.js / npm
Python / pip
The intention is to keep matching releases of
Astronomy Engine at a common version number.
When documentation refers to a Body value, e.g. Body.Earth,
link to its information page. I'm not sure this is super helpful,
but it is an attempt to provide better linking.
Added more explanatory text about the SSB and EMB values.
I found that a blank line splits the extra text onto the
dedicated pages for SSB and EMB, while leaving the "brief"
description on the list of all Body enum values. That is nice.
I found that there were a bunch of lingering 'jvm'
tags in the generated markdown documentation.
Got rid of them with another change to format_kotlin_doc.py.
I missed a couple of places where I want to remove
private constructor calls from enum members.
Also, discard [name] and [ordinal] links while preserving
other properties that are intentionally exposed.
I reported an issue to Dokka about enum members
being listed backwards in the generated markdown:
https://github.com/Kotlin/dokka/issues/2466
In the meantime, this is a workaround where I reverse the order
of the enum members in my own script format_kotlin_doc.py.
This is a workaround for a Dokka GFM issue I reported:
https://github.com/Kotlin/dokka/issues/2468
I updated the format_kotlin_doc.py script to
remove the internal constructor calls for members of the Body enum.
The dokkaGfm tool has a few oddities I don't like.
I updated my format_kotlin_doc.py script to work around
a couple of them:
1. Strip out all the noisy [jvm] tags it puts everywhere.
2. Remove the unhelpful and incorrect `Properties` sections
it adds to all my enum classes and enum members.
I will come back and address other issues later.
Added functions:
searchPlanetApsis
nextPlanetApsis
I discovered that I had an unnecessary special relaxation
of apsis error tolerance for Pluto. It turns out that currently
0.1 degrees of orbital rotation is enough for all the planets.
Search for times when the Moon ascends or descends
through the ecliptic plane. These are called
ascending and descending nodes. Added the functions:
searchMoonNode
nextMoonNode
Also corrected comments in the unit tests that
incorrectly stated nodes occur when the ecliptic
longitude is zero. They should have said the
ecliptic latitude is zero.
The existing lunar libration functions in the
other languages (C, C#, Python, JavaScript) were
calculating the Moon's ecliptic latitude and longitude
in radians, not degrees as intended. They have been fixed.
Implemented the libration function for Kotlin.
Calculate the position and velocity of any
of the five Lagrange points for a pair of
Solar System bodies. Added the functions:
lagrangePoint
lagrangePointFast
Implemented the `illumination` function, which calculates
visual magnitude, illuminated phase angle/fraction, and
ring tilt for Saturn.
Implemented `searchPeakMagnitude` for finding when
Venus appears brightest in the sky.
This function calculates how easy it is to see a given planet
with respect to the Sun: how far apart they are in the sky,
and whether the planet is easier to see in the morning or evening.
This function is especially helpful for spotting Mercury,
but it works with any body.
Generate longitude output files that are tested by
the `generate` program.
Discovered that Windows `run.bat` was not correctly testing
the longitude output test files generated by the JavaScript
code. Fixed that.
Implemented searchRelativeLongitude, which finds
planetary conjunctions and oppositions.
Discovered I can make all languages' unit tests
more strict: 6.8 minute error tolerance instead of 15.
Fixed documentation mistake in C# function SearchRelativeLongitude:
the function cannot return null. It either finds a solution time
or throws an exception.
Simplified Kotlin unit tests: use a more compact pattern of
scanning space-delimited tokens in lines.
Added geoEmbState: calculates the geocentric
state vector of the Earth/Moon Barycenter (EMB).
Added baryState: calculates the barycentric
state vector of a body.
Unit tests now support parsing JPL Horizons
state vector text files.
The Kotlin version of Astronomy Engine was using Java
classes like `Date` and `GregorianCalendar`.
Reworked the code to use a completely self-contained
representation of calendar date/time, just like the C version does.
Now Astronomy Engine does not depend on anything outside of
the Kotlin standard library. This should allow us to use
Astronomy Engine for Kotlin Native apps, Web Assembly, etc.
Updated Java demo to use the new method Time.fromMillisecondsSince1970.
Added functions:
searchGlobalSolarEclipse
nextGlobalSolarEclipse
These functions find a solar eclipse that is visible
somewhere on the Earth. They report the time of the
eclipse, what kind it is (partial, annular, total),
and if annular/total, the geographic location where
the eclipse is greatest.
Added functions:
searchLunarEclipse
nextLunarEclipse
These allow searching for a series of consecutive
lunar eclipses, including penumbral, partial,
and total eclipses.
Added a few extra functions that will be used soon
to search for solar eclipses (global and local) and
transits of Mercury and Venus.
Renamed AstroTime to Time.
Renamed AstroVector to Vector.
For some reason this breaks the Java demo build.
I'm pushing the broken build anyway to see if
ebraminio can help me fix it.
Changed RotationMatrix.identity from a variable to a function.
I want to leave open the possibility of mutating matrices
in the future, for the sake of performance critical code.
That means it is a good idea to create a new matrix to avoid
unintended side effects.
Removed redundant function equatorFromVector.
It was the same as Vector.toEquatorial.
Moved nextMoonQuarter to be right after searchMoonQuarter.
Somehow other functions had ended up between them.
Simpler syntax for initializing SearchContextPeakAltitude.