Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
e03289a8cc Fixed #120 - google-closure-compiler now works on Raspberry Pi.
Worked around an issue where the npm package google-closure-compiler
assumes the current architecture is Intel x64.
This caused a broken install on the Raspberry Pi.
Detect non-Intel architecture and fall back to installing
only the Java version of the Closure compiler.
2021-09-18 21:56:02 -04:00
Don Cross
57177a506e Resolved security issue CVE-2021-23343.
The following security issue was reported by
Dependabot for the code generator script:

https://github.com/advisories/GHSA-hj48-42vr-x3v9

The issue was that the npm package path-parse 1.0.6
had a regex denial-of-service attack.
I have updated to use path-parse 1.0.7.

The user-facing Astronomy Engine library has no external
dependencies, so there is no need for most users to
be concerned with this change. The only affected component
was the internal code generator used to produce the
distributed source files, which is only run on my own
machine and the GitHub CI hook when I push a new change.

I verified that this update has no effect on the generated code.
2021-08-12 10:10:27 -04:00
Don Cross
b32b2705ee Fixed JS doc formatting mistake.
The formatting of the JS documentation for class
GlobalSolarEclipseInformation was messed up in the
generated Markdown file. Fixed that issue in the
JS comments.

Bumping npm version to 2.0.6, to include recent
barycentric state and Earth gravity calculations.
npm_2.0.6
2021-07-23 19:25:03 -04:00
Don Cross
aa2eb01dbf Python ObserverGravity function. 2021-07-19 22:09:49 -04:00
Don Cross
a9479832dd JavaScript ObserverGravity function. 2021-07-19 17:27:33 -04:00
Don Cross
1e53f09630 C# ObserverGravity function. 2021-07-19 17:09:08 -04:00
Don Cross
37084a156d C Earth gravity calculation.
Implemented the C function Astronomy_ObserverGravity.
It implements the WGS 84 Ellipsoidal Gravity Formula,
yielding the effective observed gravitational acceleration
at a location on or above the Earth's surface.
Wrote a demo program that also serves as a unit test.
I verified a few of the calculations, so the file
demo/c/test/gravity_correct.txt also serves as correct
unit test output.
2021-07-19 14:23:27 -04:00
Don Cross
b7fe4788ab Fixed #115 - Merge branch 'aberration' 2021-07-14 21:56:28 -04:00
Don Cross
131638a964 equator_of_date.js demo now corrects aberration. 2021-07-14 21:54:58 -04:00
Don Cross
56b4852542 Documented the BaryState functions. 2021-07-14 20:28:15 -04:00
Don Cross
827e083e34 Implemented Python aberration unit test. 2021-07-14 20:09:28 -04:00
Don Cross
bd29e67663 Implemented C# AberrationTest. 2021-07-13 22:00:01 -04:00
Don Cross
0d23d46f74 Implemented Python function BaryState. 2021-07-13 20:43:50 -04:00
Don Cross
0ee6b22279 C# BaryState implemented. 2021-07-12 22:23:14 -04:00
Don Cross
77854a8bd7 Web page demo: moon radar pulse round trip.
Added a web page that calculates the round trip time
of a radar pulse from an observer at a given location on
the surface of the Earth to bounce from the Moon and return
back to that observer.
2021-07-12 19:45:45 -04:00
Don Cross
e2e21f5681 Ported AberrationTest from C to JS.
The aberration unit test that relies on barycentric
velocity calculation for the Earth's geocenter
has been ported from C to JS and shows identical results.
2021-07-11 20:41:27 -04:00
Don Cross
e398aa43a4 JS: Implemented BaryState function.
Ported the C version of BaryState to JavaScript.

Fixed an issue in both the C and JS unit tests:
the JPL Horizons data is given in terms of TT, not UT.
2021-07-11 19:40:27 -04:00
Don Cross
5de0979f7c C: successful validation of aberration correction.
I updated the C aberration unit test to use the barycentric
velocity of the Earth to adjust the apparent position of
a star. This brought the error compared to JPL Horizons
data down from 20.5+ arcseconds to less than 0.4 arcseconds.
Success!
2021-07-11 16:34:03 -04:00
Don Cross
d1ce2674fc C: Added GM constants for remaining planets. 2021-07-11 15:26:10 -04:00
Don Cross
8e9e0efd96 C BaryState: finished unit test.
Astronomy_BaryState() is working, with varying degrees
of accuracy for the different supported bodies.
2021-07-10 20:57:58 -04:00
Don Cross
22002ab9ce C BaryState: first version, test in progress.
Implemented the C function Astronomy_BaryState().
Used JPL Horizons to generate some test data.
Started work on the C unit test for BaryState,
but it is not yet finished. This is just a good
checkpoint for this work in progress.
2021-07-10 19:34:14 -04:00
Don Cross
b005bdef5a Starting to implement generalized aberration.
I realize some use cases require adjustments for
stellar aberration. The existing aberration adjustments
are only supplied for calculating planet positions.
Some users will benefit from being able to add/subtract
aberration corrections to arbitrary vectors, including
for star positions.

I have added some JPL Horizons test data to help
validate the aberration functionality I'm about to add.
I created the beginning of a unit test in ctest.c,
but currently there is no aberration correction
implemented, so the test has no error threshold.
2021-07-09 20:31:23 -04:00
Don Cross
5ea2bf65a1 equator_of_date.js defaults to current date/time.
Allow this demo to use the current date and time by
default if the user does not specify one on the command
line. This required changing the order of the command line
parameters.
2021-07-06 20:58:31 -04:00
Don Cross
7d955c99ba Added demo program equator_of_date.js.
Given the right ascension and declination of a star,
expressed in J2000 coordinates, this demo converts those coordinates
to right ascension and declination expressed in the Earth's
equator at any given date and time. This example illustrates
how to use rotation matrices to convert one coordinate system
to another.

This example was prompted by the question at:

https://github.com/cosinekitty/astronomy/discussions/114
2021-07-06 20:21:07 -04:00
Don Cross
c77e5a5845 Publishing npm version 2.0.5. npm_2.0.5 2021-06-22 14:02:58 -04:00
Don Cross
87926a71c1 Implemented C# 'triangulate' demo. Added doc links. 2021-06-22 13:51:14 -04:00
Don Cross
50019fafce Implemented JavaScript 'triangulate' demo. 2021-06-22 11:45:07 -04:00
Don Cross
2eec19fc23 Implemented C version of demo 'triangulate'.
Just like the Python version, this program calculates
the best-fit intersection point for two lines of sight
as seen by two observers. It demonstrates converting
back and forth between geographic coordinates and
geocentric vectors.
2021-06-22 10:50:47 -04:00
Don Cross
a28aa5c3d9 One more documentation fix for JavaScript. 2021-06-21 21:20:05 -04:00
Don Cross
95960a962a Documentation fixes for JavaScript. 2021-06-21 20:56:38 -04:00
Don Cross
8abda4ea30 Documentation fixes for VectorObserver functions. 2021-06-21 20:23:33 -04:00
Don Cross
6060a36b09 C#: Implemented VectorObserver. 2021-06-21 18:47:08 -04:00
Don Cross
90f5ea367e JS: Implemented VectorObserver. 2021-06-21 16:45:59 -04:00
Don Cross
7b543249b1 Implemented C version of VectorObserver. 2021-06-21 15:34:56 -04:00
Don Cross
72030c5bcf Python _inverse_terra uses Newton's Method.
Instead of the hack call to Search(), the latitude
solver now uses Newton's Method directly. This
significantly speeds up the code, and is more elegant.
2021-06-20 21:19:15 -04:00
Don Cross
2ba632694b Oops. Fixed typo in triangulate.py output. 2021-06-20 13:50:44 -04:00
Don Cross
4fc1f95c50 Print error estimate in triangulator.
The program triangulate.py finds the point in space
where two vantage lines come closest to each other.
It is the midpoint between the closest points on both lines.
Now I print the distance between those two points also,
as a measure of how much uncertainty there is in the
estimation of the target object.
2021-06-20 13:39:48 -04:00
Don Cross
829328a1d2 PY VectorObserver: stricter latitude tolerance.
Added more exhaustive testing of VectorObserver.
I found a few cases where the height calculation
was off by more than 5 millimeters.

In the VectorObserver function, require the latitude solver
to keep iterating until the error is less than one billionth
of a degree. Now the height error is always within 1 mm.
2021-06-20 12:04:21 -04:00
Don Cross
2aa26aba78 Python: implemented VectorObserver function.
I already had the function ObserverVector that converts geographic
coordinates (latitude, longitude, elevation) to an equatorial-of-date
(EQD) vector.

Now I'm in the process of adding the inverse function VectorObserver
that calculates geographic coordinates from an EQD vector.
This commit implements VectorObserver in Python.
The other languages will follow in future commits.

The motivation was from the following request:
https://github.com/cosinekitty/geocalc/issues/1
The goal is to find the near-intersection between two different lines
of sight from two different observers on the Earth's surface.
Added a demo program triangulate.py that solves this problem.
2021-06-20 10:57:12 -04:00
Don Cross
04ba909b30 Starting to solve triangulation math problem.
I believe I have solved for the closest pair of points
on a pair of skew lines. Not quite finished;
this is work in progress.
2021-06-17 21:58:53 -04:00
Don Cross
b9daddd04c Added demo program galactic.py.
This is the Python version of a demo to convert
galactic coordinates to horizontal coordinates for
a given time and geographic location.
2021-06-14 12:29:33 -04:00
Don Cross
9287fedec1 Added demo galactic.c for converting GAL to HOR.
This demo program converts galactic coordinates to
local altitude an azimuth for a given geographic
location and time.
2021-06-14 11:36:14 -04:00
Don Cross
52fb59b32e Python: Implemented EQJ/GAL conversions.
Ported conversion to/from galactic coordinates to Python.
Added unit test for new Python code.
Updated documentation for all 4 supported languages.
Fixed mistakes in JavaScript function documentation.
2021-06-10 20:48:11 -04:00
Don Cross
15988c87df Ported GAL/EQJ conversion to JavaScript. 2021-06-09 21:11:30 -04:00
Don Cross
f8b449bbbe Ported GAL/EQJ conversion to C#.
The C# version of Astronomy Engine can create rotation
matrices to convert between equatorial J2000 (EQJ)
and galactic (GAL) orientations.
2021-06-08 21:59:36 -04:00
Don Cross
3e870d6a99 Updated Windows build for testing galactic coordinates. 2021-06-08 16:40:36 -04:00
Don Cross
63a196edb9 Updated instructions for JPL Horizons galactic data. 2021-06-07 21:04:16 -04:00
Don Cross
31e7511f89 C EQJ/GAL: test using JPL Horizons data.
I added this test, but unfortunately I could not figure
out how to make JPL Horizons generate equatorial and galactic
coordinates using the same aberration model. This appears
to introduce an extra 22 arcseconds of error.
2021-06-07 21:01:37 -04:00
Don Cross
21000df4db C: Verify GAL/EQJ rotation is inverse of EQJ/GAL.
Added a sanity check in the unit tests that the functions
Astronomy_Rotation_EQJ_GAL and Astronomy_Rotation_GAL_EQJ
return matrices that really are inverses of each other.
2021-06-06 22:00:07 -04:00
Don Cross
c46a316464 C functions for galactic coordinates.
Added the following C functions:

Astronomy_Rotation_EQJ_GAL
Astronomy_Rotation_GAL_EQJ

These return rotation matrices to convert between
the galactic and J2000 equatorial orientation systems.
2021-06-06 21:32:56 -04:00