Commit Graph

57 Commits

Author SHA1 Message Date
Don Cross
5e2292dfa6 Kotlin: added metersAboveGround parameter to searchRiseSet. 2023-03-12 22:10:50 -04:00
Don Cross
de8521fa49 Kotlin: atmosphere function. 2023-03-12 14:34:14 -04:00
Don Cross
632d059972 Kotlin: implemented hourAngle function. 2023-02-12 18:13:36 -05:00
Don Cross
1a4f842764 Updated Ecliptic to return ECL in all languages. 2022-12-10 19:35:42 -05:00
Don Cross
f959599497 Completed EQJ/ECT, ECT/EQJ rotations. 2022-12-09 13:12:42 -05:00
Don Cross
281180db24 Use consistent descriptions of EQJ, ECL.
Use consistent wording for these two orientation systems:
EQJ = J2000 mean equator
ECL = J2000 mean ecliptic
2022-12-08 16:16:41 -05:00
Don Cross
1d57802470 Kotlin: implemented EQD/ECT rotations. 2022-12-06 21:12:31 -05:00
Don Cross
5087e4df28 More documentation fixes for rise/set, altitude. 2022-11-27 13:56:51 -05:00
Don Cross
fe625c5956 Kotlin: added support for user-defined stars. 2022-11-22 19:29:15 -05:00
Don Cross
8fa81d0fbc Fixed botched commit: didn't update Kotlin docs. 2022-11-14 13:40:10 -05:00
Don Cross
351e997a2f Merge branch 'riseset_poles'
Fixed issues with finding rise/set events near the
Earth's poles. Avoid assumptions that rise/set is
tied to hour angles.
2022-11-14 12:05:20 -05:00
Don Cross
275e3a7c79 Kotlin: added function planetOrbitalPeriod. 2022-11-01 19:16:32 -04:00
Don Cross
06b62887d2 Kotlin: obscuration for solar, lunar eclipses. 2022-10-20 17:31:21 -04:00
Don Cross
c1759b081a Kotlin: Reverse chrono search for rise/set, hour angles.
The following Kotlin functions now support searching
in forward or reverse chronological order:

    searchRiseSet
    searchAltitude
    searchHourAngle
2022-10-01 11:26:03 -04:00
Don Cross
409451b3c2 Kotlin: light travel time correction. 2022-05-31 20:52:41 -04:00
Don Cross
efb59436c1 Kotlin gravsim: work in progress
Started implementing class GravitySimulator,
but it is not finished yet.
2022-05-15 05:02:38 -04:00
Don Cross
5676049596 Kotlin: added iterator helper functions
Added the following iterator functions that wrap
search/next pairs of functions:

    globalSolarEclipsesAfter
    localSolarEclipsesAfter
    lunarApsidesAfter
    lunarEclipsesAfter
    moonNodesAfter
    moonQuartersAfter
    planetApsidesAfter
    transitsAfter

I updated the following Kotlin demos:

    MoonPhase.kt    ==> moonQuartersAfter
    LunarEclipse.kt ==> lunarEclipsesAfter

However, I have not yet figured out how to use these
functions in the corresponding Java demos.
2022-05-06 21:52:27 -04:00
Don Cross
ac7bc9c919 Kotlin: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 13:01:19 -04:00
Don Cross
bdb28eee2e Kotlin demo: rise/set/culmination
Added Kotlin demo to search for rise/set/culmination
of the Sun and Moon.

Enhanced the Time class to allow it to be
directly compared and sorted.
2022-05-03 21:09:56 -04:00
Don Cross
f670ae2127 Added Kotlin demo: jupiter_moons.
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
2022-05-02 14:57:16 -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
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
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
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
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
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
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
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
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
Ebrahim Byagowi
086a1f602d kotlin: Turn calculation functions to top level declaration 2022-04-09 03:59:12 +04:30
Don Cross
1d491118e9 Kotlin: implemented search for rise/set, hour angle.
Implemented the following Kotlin functions:

    Astronomy.searchHourAngle
    Astronomy.searchRiseSet

The Kotlin code can now search for rise/set
times for a given Earthbound observer for the
Sun, Moon, or any planet.

It can also search for times when a given body
reaches a desired hour angle. This has its own
value (for example, culmination), but is also
used to assist finding time brackets that bound
rise/set events.

Added special case exception type:
EarthNotAllowedException.
This follows the pattern of the other languages,
and makes diagnosing a violation easier than
the more generic InvalidBodyException.

Minor simplifications to the C# function
Astronomy.InternalSearchAltitude.

Improved the comments for the C# unit test
function RiseSetTest. They make the algorithm
easier to understand.
2022-04-07 11:56:28 -04:00
Don Cross
10bb3f30de Kotlin: implemented seasons search.
Implemented the following related functions in Kotlin:

    sunPosition
    searchSunLongitude
    seasons

C#: fail Astronomy.Seasons with an exception if any of the
equinox/solstice searches fail. If this ever happens, it is
an internal error. It should not be the burden of the caller
to check for nulls!  Fixed mistake in documentation for
searchSunLongitude.
2022-04-03 20:02:11 -04:00
Don Cross
075a80fde8 Kotlin: Implemented Astronomy.search.
Implemented the low-level search function that will be used
to implement all the special-purpose search functions to come.

Added missing documentation to class NodeEventInfo members.

Minor cleanup in the C# function `Astronomy.Search`:
- removed an unused output parameter.
- deleted confusing sentence in documentation.
2022-04-03 10:37:12 -04:00
Don Cross
aeb6e90028 Kotlin: starting to add rotation functions.
Starting to add the functions that create rotation
matrices to convert from one orientation to another.
Here are the ones implemented in this commit:

    rotationEqjEcl
    rotationEclEqj
    rotationEqjEqd

Also starting to add missing documentation to
resolve Dokka warnings.
2022-04-01 18:12:21 -04:00
Don Cross
74a1274c85 Kotlin: Implemented functions: geoVector, equator, horizon.
Implemented more of the core functions needed for
the AstroCheck tests. Most of AstroCheck is now implemented,
except for the JupiterMoons tests.

Code cleanup thanks to @ebraminio:
- Use `when { }` syntax.
- Renamed `IllumInfo` to `IlluminationInfo`.
- Other minor naming fixes.

Configured Dokka to warn about undocumented symbols.

We also configured Dokka to omit internal symbols, including
inside enums, but that does not work, despite this bug
being marked fixed in dokka:

https://github.com/Kotlin/dokka/issues/1802

We suspect they didn't really fix the bug, and that
there is a bug in their test.
2022-03-30 20:42:24 -04:00
Don Cross
f2d19c4dcc Fixed #179: Fixed Kotlin hyperlinks.
Thanks to @ebraminio for telling me how to fix the
Kotlin docstring hyperlinks. Symbols just need to be put
in brackets, not prefixed by a pound sign.
2022-03-30 14:48:20 -04:00