Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
53c8d7145a Publish generated Kotlin documentation to GitHub.
Merge a custom Markdown prefix with documentation
generated by dokka from Kotlin source code into
the published GitHub page. See the new script:

    generate/kotlindoc/format_kotlin_doc.py

The result is not yet quite what I want, but it
is much better than nothing.

Things to improve:

The `object Astronomy` link should not be hidden
in the middle of the other types. It should be
expanded and promoted to the top level.
2022-03-23 20:36:00 -04:00
Don Cross
40e0fb7b4f Kotlin: Another batch of functions ported.
Converting between radians and degrees.
Clamping angles to a desired range of degrees.
Converting between vector, spherical, horizontal.
Refraction and inverse refraction.
2022-03-23 17:21:37 -04:00
Don Cross
94aba0240a Kotlin: rotate a state vector.
Bootstrapped the function for rotating a vector
to rotate a state vector (position and velocity combined).
2022-03-23 14:36:42 -04:00
Don Cross
b0929b1b49 Kotlin: added rotation matrix functions and unit tests.
Implemented most of the RotationMatrix functions.
Added unit tests for combining rotation matrices, using a
rotation matrix to rotate a vector, and pivoting a rotation
matrix around its axes.

Replaced AstroVector operator '*' with infix function 'dot',
because it removes ambiguity between vector dot products
and vector cross products.
Later I will add a 'cross' infix function too.

Corrected minor typo in documentation for Python, C, C#, JavaScript.
"trasnform" -> "transform"
2022-03-23 14:25:32 -04:00
Don Cross
9e343aef8a Kotlin: Minor code cleanup.
Moved Astronomy object to bottom of source file.
This object is going to end up with a lot of functions,
so it's best to keep outer classes above it.

Removed unnecessary empty {} after classes.

Replace Array<Array<Double>> with Array<DoubleArray>.
This is more efficient because Array<Double> boxes the numbers
inside it, whereas DoubleArray is unboxed.
2022-03-23 12:31:43 -04:00
Don Cross
79d66bb00b Kotlin: added a few more type definitions.
StateVector
JupiterMoonsInfo
RotationMatrix
Spherical
Observer
EquatorEpoch
Aberration
Refraction
Direction
Visibility
Equatorial
2022-03-22 20:52:07 -04:00
Don Cross
8a9e30a888 Kotlin: Added AstroVector class. 2022-03-22 17:07:02 -04:00
Don Cross
57ab910abb Automate validation of Java demos in Windows. 2022-03-22 16:04:36 -04:00
Don Cross
ae5e744e1b Verify that Java demos work. Prep more demos.
Restructured the Java code so we pass in command
line arguments to select which demo we want to run.
We will also pass in date/time, latitude/longitude,
or whatever numeric data we need for future demos.

Automated test run of the Java demos from the
unit test suite.
2022-03-22 12:55:49 -04:00
Don Cross
0393d360e5 Merge JavaScript node/browser examples in README. 2022-03-22 12:09:25 -04:00
Don Cross
a2e3928ef5 Merge pull request #174 from ebraminio/kotlin
jvm: Make the demo project able to produce fat jars
2022-03-22 11:09:53 -04:00
Ebrahim Byagowi
a17456514e kotlin: Use Kotlin test and its asserters
It provides more idiomatic asserters to Kotlin.
2022-03-22 19:30:41 +04:30
Ebrahim Byagowi
c588da34c9 jvm: Make the demo project able to produce fat jars
Adopted from https://stackoverflow.com/a/63332420

So one can run the demo with `./gradlew jar && java -jar build/libs/astronomy-demo-0.0.1.jar`
instead `./gradlew run`
2022-03-22 19:25:41 +04:30
Don Cross
f031d6fc64 Added placeholder links to Android, Java demos. 2022-03-21 20:52:46 -04:00
Don Cross
6dd1d21766 Merge pull request #172 from ebraminio/kotlin
kotlin: Add a Java demo project
2022-03-21 20:08:19 -04:00
Ebrahim Byagowi
c318b586eb kotlin: Add a Java demo project 2022-03-22 04:33:10 +04:30
Don Cross
4e73831775 Merge pull request #173 from ebraminio/kotlin-android
kotlin: Add Android demo project
2022-03-21 19:37:39 -04:00
Ebrahim Byagowi
879aceec96 kotlin: Add Android demo project 2022-03-21 23:40:14 +03:30
Don Cross
887a200ac8 Cleaned up kotlin_language.svg. 2022-03-21 15:24:43 -04:00
Don Cross
6b880894e2 Added Kotlin to supported language list.
The main README.md now includes Kotlin as a supported
language.

Pivoted the table so languages are listed vertically
instead of horizontally, because this fits better on
a screen, especially using the GitHub mobile app.

There is a link to Kotlin demos, but there are no
demos implemented yet.

Likewise, there is a link to Kotlin documentation,
but the generated documentation is not stored in Git yet,
so there is no actual documentation generated from docstrings
in the code yet.
2022-03-21 15:20:55 -04:00
Don Cross
8fd8d7b624 Kotlin AstroTime: millisecond resolution, ISO 8601
Allow floating point values for seconds when initializing
an AstroTime from (year, month, ..., seconds).
AstroTime can now represent date/time to millisecond resolution.

Represent AstroTime strings in ISO 8601 format:
yyyy-mm-ddThh:mm:ss.sssZ

Minor docstring fixes.

Rename target file to 'astronomy.kt'.
2022-03-21 13:28:49 -04:00
Don Cross
7a6c8e62bb Fixed broken build - updated template Kotlin.
Code changes need to be made to

    generate/template/astronomy.kt

and then the target code Main.kt is written by
the code generator. Then both must be committed to git
before pushing to GitHub.
2022-03-21 10:34:16 -04:00
Don Cross
9d76ef3619 Merge pull request #170 from ebraminio/kotlin
Make AstroTime class Kotlin's port complete and port TerseVector
2022-03-21 09:42:07 -04:00
Ebrahim Byagowi
f8771922d3 kotlin: Drop .0 where isn't needed 2022-03-21 15:25:29 +03:30
Ebrahim Byagowi
c9f4ce46e7 kotlin: Replace repetitive ifs with when 2022-03-21 15:21:47 +03:30
Ebrahim Byagowi
46e3088dd0 kotlin: Port TerseVector 2022-03-21 14:31:26 +03:30
Ebrahim Byagowi
88b2a38651 kotlin: Move AstroTime primary constructor to top level
This is more idiomatic Kotlin.
2022-03-21 14:11:04 +03:30
Ebrahim Byagowi
a4fc126a08 kotlin: Implement AstroTime.addDays 2022-03-21 13:55:18 +03:30
Ebrahim Byagowi
adf7b7a991 kotlin: Implement AstroTime toString 2022-03-21 13:48:06 +03:30
Ebrahim Byagowi
60e470b9c3 kotlin: Implement AstroTime.fromTerrestrialTime 2022-03-21 12:50:25 +03:30
Ebrahim Byagowi
e786e8af65 kotlin: Port other AstroTime constructors 2022-03-21 12:36:50 +03:30
Ebrahim Byagowi
6839240b18 kotlin: Use object instead explicit instancing 2022-03-21 11:42:48 +03:30
Ebrahim Byagowi
cd1617e47f kotlin: Minor style fixes
* Drop unnecessary semicolons
* Turn var to val where possible
2022-03-21 11:41:52 +03:30
Don Cross
2d0abac818 Reformatted Kotlin source code. 2022-03-20 20:59:01 -04:00
Don Cross
8093ceff2a Kotlin: started class AstroTime, delta-t calc. 2022-03-20 20:54:33 -04:00
Don Cross
a278a893ff Merge branch 'master' into kotlin
This brings in recent fixes to the Python
pip package build process.
2022-03-20 20:00:43 -04:00
Don Cross
74044b39d3 More Python/pip package cleanup : version 2.0.17.
Generate astronomy.py directly in the package directory.
I realized it doesn't make sense to generate it in the
parent directory and then copy it; just generate it where
it will end up anyway.

Updated documentation so people know they can just do

    pip install astronomy-engine

to install Astronomy Engine in their Python project.

Removed the GitHub Actions status badge because it is redundant with
the checkmark/X indicator.

Now that private symbols are no longer exported, I had to
fix a couple of places where the unit tests still accessed them.
2022-03-20 16:47:29 -04:00
Don Cross
8963fb7b69 Hide private symbols in Python package.
I realized that the way I structured the pip package
in version 2.0.15 made the private symbols (those whose
names begin with an underscore) to be visible by the importer.
I reworked the package structure so this no longer happens.

This is now fixed in:
https://pypi.org/project/astronomy-engine/2.0.16/
2022-03-20 14:24:00 -04:00
Don Cross
2a92ad70c0 Fixed pip package. Added SiderealTime to pip, npm.
The pip package was broken!
I violated ancient software development wisdom:
"If you haven't tested it, it doesn't work."
It is now working in:

https://pypi.org/project/astronomy-engine/2.0.15/

Version 2.0.15 of Astronomy Engine for Python (pip)
and Node.js (npm) add support for the new SiderealTime
function. This was previously an internal function,
but now it is exposed for outside callers.
2022-03-20 13:42:16 -04:00
Don Cross
e92cf212f2 Added Kotlin to source code generator.
This is just a stub to get started. None of the
necessary macros have been implemented in the Kotlin
code generator. But at least I can start editing the
Kotlin template and generating code from it.
2022-03-18 20:28:14 -04:00
Don Cross
0f0fab513a Kotlin: implemented Body enum with code docs.
Implemented the Body enum, with documentation strings
in comments. Reworked the Gradle build to generate
GitHub Flavored Markdown (gfm) instead of html.
2022-03-18 20:10:51 -04:00
Don Cross
ff16ae0a90 Windows Kotlin build: need to call gradlew.bat.
Because the 'gradlew' command is a batch file in
Windows, I need to use the 'call' command to invoke
it from run.bat, or it does not return to run.bat.
2022-03-18 07:31:46 -04:00
Don Cross
a0723c7406 Kotlin build/test integrated with 'run' scripts.
Instead of being executed directly by the GitHub Actions
yml file, the Kotlin build now has been integrated with
the build/test steps for the other 4 languages in the
bash script `generate/run` and the Windows batch file
`generate/run.bat`. This will be necessary to control the
order of execution, because the Kotlin source code will have
to be written by the code generator before it is built
and executed.

I also added hints for myself and other contributors about
how to set up Kotlin/JDK tools on a new developement machine.
These instructions are not needed by most users of Astronomy Engine,
just contributors.
2022-03-17 20:52:32 -04:00
Don Cross
0943f058c9 Fixed #165 - expose sidereal time function.
There was already an internal function for calculating
Greenwich Apparent Sidereal Time (GAST). By request,
I have exposed this function for outside users.

Added a minimal unit test to verify the function is
callable and returns the correct result for one case.
This function is already exhaustively tested by unit
tests that verify other functions that already called
this function when it was internal, so minimal testing
is sufficient in this case.
2022-03-15 20:48:02 -04:00
Don Cross
f0fe2f42ce Merge pull request #168 from ebraminio/kotlin
Enable Kotlin testing in macOS and Windows
2022-03-15 19:27:32 -04:00
Ebrahim Byagowi
34bf5f1497 Enable Kotlin testing in macOS and Windows 2022-03-16 01:54:27 +03:30
Don Cross
4a63ff45cf Merge pull request #167 from ebraminio/master
Add Kotlin project structure
2022-03-15 14:10:20 -04:00
Ebrahim Byagowi
01a0a89109 Add Kotlin project structure 2022-03-15 21:37:42 +03:30
Don Cross
1a645fea18 Bumped npm,pypi versions to 2.0.13 to test publish.
The way I was publishing the Python package was annoying.
I found a better way to authenticate myself to pypi.org,
but I needed to test it. This required bumping the version
numbers of the packages. There is no difference between
2.0.12 and 2.0.13.
2022-03-14 05:09:56 -04:00
Don Cross
bc42d609c1 Updated pip, npm packages to v 2.0.12.
This version of the Python and Node.js packages includes
support for calculating Lagrange points.
Also added a pypi.org badge to the main README.md.
2022-03-14 04:46:44 -04:00