Commit Graph

1683 Commits

Author SHA1 Message Date
Don Cross
565bac127a Kotlin docs: link to body enum values.
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.
2022-04-25 20:43:41 -04:00
Don Cross
4c34245c01 Kotlin doc cleanup: removed more 'jvm' tags.
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.
2022-04-25 17:16:46 -04:00
Don Cross
d130405d13 Kotlin docs: more enum cleanup.
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.
2022-04-25 16:51:25 -04:00
Don Cross
b7c7733370 Kotlin docs: fixed backwards enum members.
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.
2022-04-25 16:41:19 -04:00
Don Cross
737fb01384 Kotlin docs: remove unwanted enum constructors.
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.
2022-04-25 16:20:18 -04:00
Don Cross
5708ae36a6 Process Kotlin documentation to fix dokka issues.
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.
2022-04-25 12:56:35 -04:00
Don Cross
e01235a260 Replaced another use of sha256sum with checksum.py. 2022-04-25 03:43:50 -04:00
Don Cross
105e806c4d Check download integrity on all operating systems.
The sha256sum and md5sum utilities are available by
default on Linux, but not Windows or Mac OS.
I created the script `checksum.py` that can perform
sha256 and md5 checksum verification on all 3 systems.

Got rid of the ugly checksum.bat I was using on Windows.
Deleted the md5 checksum files, since I only need sha256
for now.

Before this change, I was always skipping verification
of downloads on Mac systems.
2022-04-25 03:08:29 -04:00
Don Cross
8696241c90 Kotlin: search for planet aphelion/perihelion.
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.
2022-04-24 20:55:51 -04:00
Don Cross
a6e72a2423 Kotlin: search for lunar nodes.
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.
2022-04-23 20:34:52 -04:00
Don Cross
3ce32f8819 Kotlin: lunar libration. Fixes for other languages.
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.
2022-04-22 16:36:14 -04:00
Don Cross
554bbf1b00 Kotlin: calculate Lagrange points.
Calculate the position and velocity of any
of the five Lagrange points for a pair of
Solar System bodies. Added the functions:

    lagrangePoint
    lagrangePointFast
2022-04-21 21:11:44 -04:00
Don Cross
e545677d67 Kotlin: observerGravity function. 2022-04-21 16:04:53 -04:00
Don Cross
567376255c Kotlin: visual magnitude, peak magnitude search.
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.
2022-04-20 19:47:21 -04:00
Don Cross
ef6af40b0d Kotlin: added maximum elongation search.
Added searchMaxElongation function, which finds the
next time Mercury or Venus reaches is maximum angular
separation from the Sun.
2022-04-18 13:03:08 -04:00
Don Cross
0af17074f2 Kotlin: elongation function.
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.
2022-04-18 11:41:46 -04:00
Don Cross
17fbf34a71 Kotlin: search lunar perigee, apogee.
Added functions to find a series of consecutive
lunar apsides:

    searchLunarApsis
    nextLunarApsis
2022-04-17 21:29:12 -04:00
Don Cross
f64d22c1c2 Kotlin: search for transits of Mercury and Venus.
Implemented functions searchTransit and nextTransit.
2022-04-17 14:40:59 -04:00
Don Cross
23ed1cda5a Kotlin: added more planet longitude tests.
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.
2022-04-17 13:30:09 -04:00
Don Cross
16578935ad Kotlin: implemented relative longitude search.
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.
2022-04-17 12:22:07 -04:00
Don Cross
a36d31b75e Merge branch 'kotlin' of https://github.com/ebraminio/astronomy into ebraminio-kotlin 2022-04-16 17:02:05 -04:00
Don Cross
4f387e5fda Kotlin: added heliocentric/topocentric state vector tests. 2022-04-16 16:23:35 -04:00
Ebrahim Byagowi
9cb3a50901 kotlin: Take advantage of functional interface syntax 2022-04-17 00:40:32 +04:30
Don Cross
0ed52f3cea Kotlin: barycentric states, geocentric moon/EMB
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.
2022-04-16 15:31:25 -04:00
Don Cross
d5fc878a6a Kotlin: calculate heliocentric ecliptic longitude
Added function: eclipticLongitude.
Verified its calculations against the same function
in the Python version of Astronomy Engine.
2022-04-16 12:59:48 -04:00
Don Cross
f0b0113806 Kotlin: added local solar eclipse prediction.
Added functions to predict solar eclipses seen
from a specified geographic location on the Earth:

    searchLocalSolarEclipse
    nextLocalSolarEclipse
2022-04-16 10:25:22 -04:00
Don Cross
896df1ad19 Removed Kotlin Native tests for now.
We are having difficulty getting Kotlin code to build for
both JVM and Native. For now, the priority is to support JVM,
so I am turning off installation of the Kotlin Native compiler.
2022-04-15 13:04:52 -04:00
Don Cross
ad439c6d97 Kotlin Native work in progress: build errors.
Checking in with the Kotlin Native tests turned off,
because the code does not build yet. Seeking help.
2022-04-14 13:16:09 -04:00
Don Cross
61e398b592 Kotlin: removed all dependencies on JVM.
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.
2022-04-14 10:55:22 -04:00
Don Cross
6b2304c5c6 Download Kotlin Native tarball without all the verbosity. 2022-04-13 20:59:17 -04:00
Don Cross
30ee194e72 Trying my own Kotlin Native installer.
I kept running into problems trying to create
a GitHub Action to install the Kotlin Native compiler.
So I am rolling my own using a bash script.
2022-04-13 20:33:04 -04:00
Don Cross
d1d18c60e6 Setting up for Kotlin Native demo/test.
Nothing very interesting yet.
Just building a very basic Kotlin Native app
to make sure build and execute work on GitHub Actions,
on Linux and Mac OS.  I will worry about Windows later.
2022-04-13 17:37:00 -04:00
Don Cross
646abeecfe Merge branch 'master' into kotlin 2022-04-13 16:39:12 -04:00
Don Cross
7553b6b749 Windows GitHub Actions: check all steps for errors
I found out in the Kotlin branch that GitHub Actions
only checks for error codes in the last step of the
Windows commands it executes. I moved all the command
line steps into a batch file generate\commit_hook.bat.
It does all the error checking itself.
2022-04-13 16:13:47 -04:00
Don Cross
b4897939cb Merge pull request #201 from ebraminio/kotlin-java
kotlin: Improve access of companions object fields/methods in Java
2022-04-13 08:15:46 -04:00
Don Cross
5c68f20099 Fixed Kotlin build error.
A build error slipped through because both
ebraminio and I were making changes to the Kotlin
code at the same time. Just needed to reorder
the parameters to a call to `search`.
2022-04-12 20:37:26 -04:00
Don Cross
ae3dd35bee GitHub Actions did not check failure in run.bat.
I just noticed a build problem in the Kotlin code
was detected by GitHub Actions in Linux and Mac OS,
but not in Windows. It marked the Windows test as
a success, even though the output clearly shows that
run.bat failed. I theorize that the steps inside
the file .github/workflows/astronomy-engine-tests.yml
are not being checked for errors after each step, but
only after all of them execute. So I have moved them
into a new batch file generate/commit_hook.bat, which
does check each step.

After pushing this change, all 3 builds should fail.
Once I get Windows to fail also, I will fix the failure.
2022-04-12 20:12:05 -04:00
Ebrahim Byagowi
b06493fd6d kotlin: Improve access of companions object fields/methods in Java 2022-04-13 04:25:22 +04:30
Don Cross
5052920517 Merge pull request #200 from ebraminio/kotlin-sam
kotlin: Move search context to the end of arguments
2022-04-12 19:22:18 -04:00
Ebrahim Byagowi
902f25db3f kotlin: Move search context to the end of arguments
This, in addition to annotating SearchContext interface as functional,
turns it into a more idiomatic Kotlin.
2022-04-13 02:53:39 +04:30
Don Cross
4c4aa3dac4 Merge pull request #199 from ebraminio/kotlin-android-demo
kotlin: Upgrade Android example to use the new namings
2022-04-12 17:25:28 -04:00
Don Cross
77b6edd2ff Kotlin: global solar eclipse search
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.
2022-04-12 16:46:40 -04:00
Ebrahim Byagowi
7ad9487c3e kotlin: Upgrade Android example to use the new namings 2022-04-12 23:29:09 +04:30
Don Cross
74cca88d9e Kotlin: lunar eclipse search
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.
2022-04-12 14:01:22 -04:00
Don Cross
a2fe6c4c38 Kotlin/Windows: fix markdown docs, just like Linux/mac. 2022-04-12 11:17:22 -04:00
Don Cross
55b5287eef Kotlin/Windows: build markdown, not html.
I discovered that the build process on Windows
was still using Dokka to make html, not markdown.
Fixed this to maintain compatibility with the
build process for Linux and Mac OS.
2022-04-12 10:55:20 -04:00
Don Cross
79ff7b2805 Kotlin: Create fatJar during initial build.
Moved the step that creates the fatJar into
the main build process for Kotlin. This is
needed to run the Java demos, and it is good
to fail early if it cannot be built.
2022-04-12 10:37:02 -04:00
Don Cross
57a736067a Kotlin: renamed AstroTime, AstroVector.
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.
2022-04-11 20:17:59 -04:00
Don Cross
4b3b445889 Kotlin: added function angleFromSun. 2022-04-10 20:42:31 -04:00
Don Cross
3dd817934e Kotlin: minor code cleanup.
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.
2022-04-10 17:23:22 -04:00