Commit Graph

404 Commits

Author SHA1 Message Date
Don Cross
4f7a6e69cb C#: Implemented calculation of Jupiter's moons. 2021-04-13 11:45:03 -04:00
Don Cross
a6b1963291 Decreased minified JS size from 98382 to 94490 bytes.
I increased the error tolerance slightly for the Jupiter moons model.
This shrank the model tables significantly, giving me some more
breathing room to stay under 100K download size.
2021-04-12 20:53:42 -04:00
Don Cross
7f26aa7c20 JS: Decreased minified browser code from 98413 to 98382 bytes.
I don't like how close I am to my 100K target size, now
that I'm calculating Jupiter's moons.
Simplified the spin() function so its minified code is smaller.
I will look for other things I can shrink too.
2021-04-12 19:27:45 -04:00
Don Cross
a0d88f2f00 JS: Added documentation for JupiterMoons function and return type. 2021-04-12 16:57:22 -04:00
Don Cross
d64a46d5e1 JS: Implemented calculation of Jupiter moons. 2021-04-12 16:19:33 -04:00
Don Cross
9b67e7f3f9 Starting development for calculating Jupiter's moons.
I am starting the process of implementing calculation
of Jupiter's four largest moons: Io, Europa, Ganymede, Callisto.
This commit just contains constant declarations for the
equatorial, polar, and volumetric mean radii of Jupiter.

The positions of the moons will be related to the center
of Jupiter and be expressed in Jupiter equatorial radius units,
so I felt it would be good to give users a way to convert to
kilometers, which can in turn be converted to AU.
2021-04-04 20:52:31 -04:00
Don Cross
6f943d9ea4 Fixed some minor documentation mistakes. JS: Export DEG2RAD, RAD2DEG. 2021-04-01 14:08:56 -04:00
Don Cross
786afdd4eb Fixed broken link to KM_PER_AU in JavaScript documentation. 2021-03-31 22:42:50 -04:00
Don Cross
c3c8ffeb0f Finished documenting ObserverVector() in topic indexes. 2021-03-31 21:49:35 -04:00
Don Cross
cfb8714da4 JS: Added unit test and documentation for ObserverVector.
Also made time parameters to rotation matrix functions be of
type FlexibleDateTime, and internally convert them to AstroTime.
This should be the policy of all exposed functions in the
JavaScript version of Astronomy Engine.

Exposed KM_PER_AU to outside callers.
2021-03-31 19:07:00 -04:00
Don Cross
085d285ef0 Refactored all the nutation and precession functions.
Use a private enumerated type to select which direction
the precession and nutation is to be done:
- from date to J2000
- from J2000 to date

Normalize the order of parameters to be consistent
between precession() and nutation(), and across languages.
Pass in AstroTime instead of a pair of floating point TT
values (one of which had to be 0).

Added TypeScript version of ObserverVector(),
but it has not yet been documented or tested.
2021-03-31 12:09:11 -04:00
Don Cross
5897c557e2 Updated npm package version to 2.0.2.
This build includes support for creating custom "camera"
orientations by arbitrary pivoting of rotation matrices.
2021-03-27 21:27:20 -04:00
Don Cross
cef88bcb79 Added missing topic index entries in Python and JavaScript README.md.
I forgot to add topic index entries for the new functions
IdentityMatrix and Pivot to the README.md files for
JavaScript and Python. Fixed it.
2021-03-27 21:12:59 -04:00
Don Cross
5cd0e60d74 Updated obsolete comments about how Delta-T is calculated.
Astronomy Engine used to use USNO historical and predictive tables,
along with linear interpolation, to calculate Delta-T values.
The problem with the USNO tables is, they did not work well outside
a few centuries around present day.

Later I replaced with Espenak & Meeus piecewise polynomials
that work over a much larger time span (thousands of years).
I just discovered there were still comments in the code referring
to the USNO models. I updated the ones I could find to reflect
the current truth about how the code works today.
2021-03-27 19:44:37 -04:00
Don Cross
6f98095cae Reworked ecliptic coordinate types to contain a vector type.
This is technically a breaking change, but only for clients
that use the cartesian coordinates in an ecliptic coordinate
return type.  Before now, the coordinates were just separate
floating-point members ex, ey, ez. Now they are a standard
vector type.

The purpose is to allow seamless interfacing with vector
rotation functions, and to be consistent with the equatorial
coordinate types.
2021-03-27 12:26:27 -04:00
Don Cross
200080ca79 JavaScript: Defined string-valued enumerated type "Body".
Instead of declaring all the "body" parameters in the
TypeScript/JavaScript code to be strings, I created a
string-valued enumerated type called Body.

The same string values can still be passed in from JavaScript
code, or callers can use syntax like Astronomy.Body.Moon.

This improves the type checking inside the TypeScript source,
plus it adds better documentation for each of the parameters.
In the generated Markdown documentation, the user can click
on the Body type and see all the supported bodies.

The other three supported languages (C, C#, Python)
already use enumerated types for bodies, so this
brings the JavaScript version more in sync with them.
2021-03-27 10:44:50 -04:00
Don Cross
0426272da4 Eliminated obsolete function VectorFromEquator.
Now that equatorial coordinates include both angles
and cartesian coordinates, there is no need for the
VectorFromEquator function. It has been removed
from all four supported languages.

The expression "VectorFromEquator(equ, time)" can be
replaced with "equ.vec" in any calling code.
2021-03-27 08:24:42 -04:00
Don Cross
a4d61c872a Added JavaScript version of camera demo.
This caused me to discover I had forgotten to finish
making the necessary changes to astronomy.ts for saving
the cartesian vector inside the EquatorialCoordinates class.

I also realized I had made a mistake in the documentation
for the y-coordinate of the vector: it is the June solstice;
there is no such thing as a September solstice!

Also fixed some mistakes in demo tests: if something failed,
I was printing out the wrong filename (camera.c instead of camera.cs).
2021-03-26 21:04:34 -04:00
Don Cross
52162aa286 Ported IdentityMatrix and Pivot functions to JavaScript. 2021-03-24 20:50:28 -04:00
Don Cross
9cc454b1f2 Added comments to explain horizontal coordinate calculations.
I'm about to start working on adding a new output
from the Horizon functions. It was a good time to better
document the ideas behind these calculations, before
adding anything new. These are internal comments only
and do not affect generated documentation.

While I was in there, I noticed extra code that was
checking for impossible return values from atan2().
I eliminated these.
2021-03-20 20:01:38 -04:00
Mateo Tibaquira
38ac8e1f88 build: include typings in the package.json 2021-03-01 08:58:50 -05:00
Don Cross
eac7750fba Fixed #86 - eliminated redundant JS functions MakeObserver and MakeSpherical.
In the TypeScript/JavaScript code, the functions MakeObserver and MakeSpherical
are no longer needed, because the classes Observer and Spherical are now exported,
along with their constructors. I deleted those functions and reworked callers
to use the equivalent constructors instead.

Also fixed a few breakages in the html/browser examples that crept in recently.
2021-02-09 19:49:00 -05:00
Don Cross
52626514e2 JS: Always use @brief in jsdoc. Corrections to JS documentation.
Although it looks less pretty in the generated Markdown,
I think it makes more sense to consistently use @brief in
the jsdoc comments for functions and classes, so that the generated
documentation.json might be more useful some day.
Added @brief comments for places it was missing.

Fixed obsolete remarks in the documentation for AstroTime:
this type, and its constructor, are both exported now.

Fixed broken link to EclipseEvent function.
2021-02-09 16:37:59 -05:00
Mateo Tibaquira
992aaf4ea1 JS: Library capable of tree-shaking
I found that the Angular bundles had all the astronomy-engine library for a total of 90.62Kb
after this change Angular is able to reduce the demo module to 54.56Kb

Based on https://toastui.medium.com/building-a-ui-library-capable-of-tree-shaking-from-a-to-z-b3f8a9be589f
2021-02-08 20:09:17 -05:00
Don Cross
b529a34c66 JS: Mention TypeScript in the Markdown documentation.
Let people know that a TypeScript version of
Astronomy Engine is now available.
2021-02-08 17:31:42 -05:00
Don Cross
ba619d553a JS: Fixed JSDOC type declaration for the Search parameter 'func'.
The JSDOC type declaration for the Search function's 'func'
parameter was 'ContinuousFunction', which is nowhere defined.
Replaced that with an inline declaration of the function type.
Unfortunately, it shows up in the Markdown code as 'function',
but at least I explain the function's parameter and return type
in the accompanying text.
2021-02-08 16:28:33 -05:00
Don Cross
edc5cb6e15 JS: Miscellaneous cleanup in TypeScript types and JSDOC comments.
Use FlexibleDateTime consistently in the JSDOC parameter types.

Expanded the documentation for FlexibleDateTime.

Because we now export the AstroTime constructor, allow it to accept
FlexibleDateTime as a parameter. This means adding the ability to
clone another AstroTime if passed in as the parameter.

Where appropriate, use the more concise TypeScript constructor syntax
that declares members and parameters at the same time.

Use @ignore in JSDOC comments for things I want to document
internally, but are not exported. This way they do not appear
in the generated Markdown files.
Added @ignored documentation for ShadowInfo and body_grav_calc_t,
because these are complicated calculations.

It looks like parentheses are not needed in JSDOC parameter
types, even when there are multiple types separated by vertical bars.
Normalize {(a|b|c)} to {a | b | c} for improved readability.

Created a TypeScript SearchOptions interface for the Search function,
instead of the inline object-shape definition.
2021-02-08 15:59:59 -05:00
Don Cross
485ce7230e JS: Removed 'export' from private functions and variables. 2021-02-08 10:16:42 -05:00
Mateo Tibaquira
958f8b0ddc JS: Fix docblock for SearchOptions 2021-02-07 23:46:01 -05:00
Mateo Tibaquira
fa6f7c0767 JS: Fix the links in the README file 2021-02-07 23:31:43 -05:00
Mateo Tibaquira
f6917c9a7d JS: Improve typedef docblocks
Restored the jsdoc2md template usage for the Javascript README.md
2021-02-07 21:39:18 -05:00
Mateo Tibaquira
44a96f8c21 JS: Improve the documentation of FlexibleDateTime
Also moved the NPM commands to the package.json
so the makedoc scripts execute them in a central place.

Installed a jsdoc theme to improve the html output.
2021-02-07 20:42:05 -05:00
Mateo Tibaquira
21c053dbed JS: Refactor the build setup
The npm dependencies required are now
installed locally inside the generate folder.

Cleaned up the Astronomy object closure for TS
and kept it for the Browser bundle.

We will have some usage examples in the website.
2021-02-07 17:09:21 -05:00
Don Cross
e5726bfae6 JS: Fixed problems passing parameters to Search, and checking for failures.
The JavaScript version of Astronomy.Search was sometimes being passed
an incorrect 'options' parameter. It should always be either omitted
or passed in an object with the correct shape.

Also, there were places where Search failures, indicated by it
returning null, should cause an immediate exception.
2021-02-07 15:17:51 -05:00
Don Cross
d776c3d453 Enabled --strict option in TypeScript compiler. Fixed resulting errors.
Improved the type checking by using tsc --strict.
Nothing substatial changed in the generated JavaScript, and no
actual bugs were found, but I removed a lot of loose/sloppy
type signatures. This should make mistakes less likely
in the JavaScript code going forward.
2021-02-05 20:46:56 -05:00
Don Cross
c5738052b4 Starting to convert JavaScript code to TypeScript, and compiling it back to JavaScript.
The goal is to provide both TypeScript and JavaScript to developers.
Will also provide a type definition file once I figure that out.
This is just the first pass through the code.
It builds and passes all the unit tests, with some minor changes
to the generated README.md.
2021-02-04 22:12:49 -05:00
Don Cross
f34b700ce3 Updated copyrights for 2021. This resolves Travis CI broken build.
I forgot that my build process automatically updates
copyright years when the current year changes.
My Travis CI unit tests verify that there are no local
changes after running all the tests.
That test failed because the update_copyrights.py changed
all the "2019-2020" to "2019-2021".
2021-01-07 08:55:52 -05:00
Don Cross
14ff7519b5 Updated npm package to 1.1.3 to include full moon search fix. 2021-01-06 21:56:27 -05:00
Don Cross
246ac47d2b Fixed a failure to find a full moon using certain start dates.
In all four versions of Astronomy Engine (C, C#, JavaScript, and Python),
starting a search for a full moon near December 19, 2020 would fail.
I added a unit test to all four languages and it failed consistently
across them all.

The root cause: I was too optimistic about how narrow I could make
the window around the approximate moon phase time in the
SearchMoonPhase functions. Finding the exact moon phase time failed
because it was outside this excessively small window around the approximate
time. I increased the window from 1.8 days to 3.0 days.
This should handle all cases with minimal impact on performance.

Now all four of the new unit tests pass.
2020-12-18 14:29:41 -05:00
Don Cross
10d7821184 npm version 1.1.2 - Improved Pluto calculation.
The minimized code astronomy.min.js is now significantly smaller
because it uses a completely new algorithm for calculating
the position of Pluto. Instead of using TOP2013 formulas directly,
it simulates the gravitational forces on Pluto between 40
precalculated checkpoints spread over a 4000 year range.
2020-08-24 21:42:06 -04:00
Don Cross
8f16f0a5ae Pluto integrator: finished porting to Python.
I believe this wraps up the Python integrator.
It now works in all 4 languages and passes all tests.
Fixed up demo tests to match new output.
Turned on Travis CI checking in this branch again.
2020-08-24 20:54:20 -04:00
Don Cross
1a2508f68b Pluto integrator: ported to JavaScript. 2020-08-24 14:14:32 -04:00
Don Cross
fa13f980b2 JS: Stricter type checking for function parameters. Other fixes.
In the JavaScript version, check throughout for valid
finite numeric/boolean values as needed.
This should make debugging a lot easier for everybody.

In the unit tests for all languages, also check for infinite
results, not just NaN.

I discovered that JS Astronomy.NextLocalSolarEclipse() was broken:
It was trying to call a nonexistent function.
Fixed it, and added unit test that would have caught the breakage.

Fixed mistakes in JS documentation for the field names of the
Observer class.
2020-07-23 20:12:36 -04:00
Don Cross
f50afb6910 npm version 1.1.1 2020-07-08 21:14:56 -04:00
Don Cross
8b2880a925 TOP2013: Ported to JavaScript. 2020-07-08 14:35:19 -04:00
Don Cross
91709e29f2 Minor cleanup of Earth radius constants in JavaScript code. 2020-07-08 11:39:46 -04:00
Don Cross
c37ade5ee3 Bumped npm version to 1.1.0 - minor documentation fixes. 2020-06-14 16:55:32 -04:00
Don Cross
2f13b463f1 Fixed two documentation formatting mistakes. 2020-06-14 16:49:02 -04:00
Don Cross
e2cb68e021 Bumped npm version to 1.0.9. 2020-06-14 15:23:28 -04:00
Don Cross
100417dbe3 Fixed #52 - Finished documenting transit functions.
This completes work on eclipses and transits.
2020-06-14 15:05:01 -04:00