Commit Graph

158 Commits

Author SHA1 Message Date
Don Cross
7c475fcada Expanded the fix for issue #347.
I tried more distant objects like Jupiter ... Neptune.
This revealed that at increasing distances, the convergence
threshold in inverse_terra needed to increased also.
So now I use 1 AU as a baseline, and scale up linearly
for more distant objects.
2024-05-27 17:07:30 -04:00
Don Cross
61dc07020a Version : official release to test #330. 2023-12-14 12:48:22 -05:00
Don Cross
6d6d6adb69 Version 2.1.18: Accepted PR #329.
Include TypeScript type definitions in the exported files.
This might be a fix for #294, but I'm not sure.
The only real way to test is to publish on npm and see what happens!
2023-12-13 16:00:30 -05:00
Don Cross
bd2db6a380 Version 2.1.17: add metersAboveGround parameter to SearchRiseSet. 2023-03-13 21:40:01 -04:00
Don Cross
8c55fbad79 JS: Added metersAboveGround parameter to SearchRiseSet. 2023-03-13 13:06:37 -04:00
Don Cross
66cd0147b5 JS: Added Atmosphere function. 2023-03-13 09:54:54 -04:00
Don Cross
543ffa358a Version 2.1.16 2023-02-26 18:02:18 -05:00
Don Cross
4ab4b0bb6e Fixed #259 - JS documentation is usable for CorrectLightTravel function.
Replace the abstract class with a parameter of function type.
This allows the documentation to fully explain how to use
`CorrectLightTravel` without having to look at the code.
2023-02-23 18:01:51 -05:00
Don Cross
d321ed695c Version 2.1.15: Python type hints. 2023-02-21 17:24:25 -05:00
Don Cross
97c4d2f8f0 Version 2.1.14: added HourAngle function. 2023-02-12 21:34:10 -05:00
Don Cross
f11e2e8c6d JS: Implemented HourAngle function. 2023-02-12 14:22:41 -05:00
Don Cross
fd4090bd65 Added title 'Astronomy Engine' to README. 2022-12-26 14:20:58 -05:00
Don Cross
1a4f842764 Updated Ecliptic to return ECL in all languages. 2022-12-10 19:35:42 -05:00
Don Cross
d4660de2a7 JS: Ecliptic function returns ECT instead of ECL. 2022-12-10 03:55:17 -05:00
Don Cross
f959599497 Completed EQJ/ECT, ECT/EQJ rotations. 2022-12-09 13:12:42 -05:00
Don Cross
dfbd268aa3 JS: Added rotation ECT/EQD. 2022-12-07 13:48:24 -05:00
Don Cross
552c7a5557 EclipticGeoMoon uses true equinox of date in all languages.
Added EclipticGeoMoon as output to the temp/*_check.txt files as 'm' lines.
This ensures that all the languages calculate nearly identical values.

Optimized EclipticGeoMoon a little more by eliminating a redundant
call to mean_obliq.
2022-12-05 21:44:35 -05:00
Don Cross
576eea2245 Unrolled loops from remaining nutation functions. 2022-12-04 21:30:22 -05:00
Don Cross
d3f36b942d Verify nutation angles are consistent across languages. 2022-12-04 14:20:44 -05:00
Don Cross
8a153315cf Simplified and optimized nutation formula.
While trying to convert ecliptic coordinates from mean
equinox of date to true equinox of date, I ran into excessive
overhead from the IAU2000B nutation model. The fact that it
uses 77 trigonometric terms made the calculations a lot slower.

https://apps.dtic.mil/sti/pdfs/AD1112517.pdf
Page 4 in the above document mentions a shorter series
“NOD version 2” that has 13 terms instead of 77 as used in IAU2000B.
I had not noticed NOD2 before, because it appears only in
the FORTRAN version of NOVAS 3.x, not the C version.

After reading the FORTRAN code, I realized NOD2 is the same
as IAU2000B, only it keeps the first 13 of 77 terms.
The terms are already arranged in descending order of
significance, so it is easy to truncate the series.

Based on this discovery, I realized I could achieve all of
the required accuracy needed for Astronomy Engine by
keeping only the first 5 terms of the nutation series.
This tremendously speeds up nutation calculations while
sacrificing only a couple of arcseconds of accuracy.

It also makes the minified JavaScript code smaller:
Before: 119500 bytes.
After:  116653 bytes.

So that's what I did here. Most of the work was updating
unit tests for accepting slightly different calculation
results.

The nutation formula change did trigger detection of a
lurking bug in the inverse_terra functions, which convert
a geocentric vector into latitude, longitude, and elevation
(i.e. an Observer object). The Newton's Method loop in
this function was not always converging, resulting in
an infinite loop. I fixed that by increasing the
convergence threshold and throwing an exception
if the loop iterates more than 10 times.

I also fixed a couple of bugs in the `demotest` scripts.
2022-12-04 10:31:15 -05:00
Don Cross
84621b4d33 Enable truncation of the IAU2000B nutation model.
Modified the code generator and source templates to allow
using fewer than 77 terms from the IAU2000B nutation model.
The number of terms causes calculations to be far slower than
I would  like, plus most of these terms provide far less than
one arcsecond of difference in the output.

I want to experiment with truncated versions of the series.

https://apps.dtic.mil/sti/pdfs/AD1112517.pdf
Page 4 in the above document references a shorter series
"NOD version 2" that has only 13 terms instead of 77 as used in IAU2000B.
I found that code and confirmed the 13 terms are the first 13
consecutive terms from the original 77.

This commit does not change the number of terms calculated;
it only enables doing so by changing a single #define in
generate/codegen.c.

Once I change the nutation model, I'm sure there will be multiple
tweaks to unit tests to get everything working again.
2022-12-03 21:29:59 -05:00
Don Cross
1725c77c9f Fixed doc typos. JS HelioState user-defined stars.
I had a copy-n-paste typo in the `dec` parameters
for all of the DefineStar functions. Fixed it.

The TypeScript version of HelioState did not handle
user-defined stars. Added support there.
2022-11-23 12:01:34 -05:00
Don Cross
098eb3ac7a Optimized HelioDistance for user-defined stars.
Because we instantly know the heliocentric
distance of a user-defined star, there is no
need to convert it into a vector and then take
the length of the vector.
All of the HelioDistance functions now return
the distance directly, as an optimization.

Also, I decided it didn't make sense to have a
default definition for user-defined stars.
If the caller doesn't define a star, it should
be treated as an invalid body.
2022-11-23 11:16:56 -05:00
Don Cross
7b7a306baf Python: Find rise/set/culm of user-defined stars.
Added Python support for user-defined stars.
Defined new StateVector methods: Position and Velocity.
Defined division operator: Vector / float.
Bumped version number to 2.1.12.
2022-11-22 21:42:02 -05:00
Don Cross
696efe8649 JS: Find rise/set/culm of user-defined stars.
DefineStar now requires passing in the heliocentric
distance of the star expressed in light-years.
That way, I can directly support returning vectors
to a star from HelioVector, GeoVector, etc.

SearchRiseSet and SearchHourAngle now work with user-defined stars.
2022-11-21 20:55:27 -05:00
Don Cross
84d6aff35a JS: Added function DefineStar.
I'm starting to implement the ability to define
up to 8 distinct points in the sky as "stars"
that will be allowed as a `body` parameter to
some Astronomy Engine functions, to be determined.
2022-11-21 12:53:45 -05:00
Don Cross
8fa81d0fbc Fixed botched commit: didn't update Kotlin docs. 2022-11-14 13:40:10 -05:00
Don Cross
d9d955a651 Altitude search: better parameter checking.
Made sure all the altitude search functions
verify that the geographic latitude and target altitude
are valid numbers in the range [-90, +90].

Reworked the C version of the code to be clearer:
eliminated goofy ALTDIFF macro, split out max
altitude derivative into its own function MaxAltitudeSlope,
just like the other language implementations do.

Minor rewording of comments in MaxAltitudeSlope functions.

Python InvalidBodyError now includes the invalid body
in the diagnostic message.
2022-11-14 11:04:46 -05:00
Don Cross
5e074d05aa Bumped version number to 2.1.10.
Not ready to tag yet, because I need to merge into
master branch first, to pick up the npm package
configuration change.
2022-11-14 08:15:23 -05:00
Don Cross
e85863acf5 JS: reworked rise/set to work in polar regions 2022-11-13 20:45:00 -05:00
Don Cross
c8af73e1e7 Fixed #256 - added orbital period functions. 2022-11-01 19:40:30 -04:00
Don Cross
bd115770e1 C: Added function Astronomy_PlanetOrbitalPeriod. 2022-11-01 16:38:57 -04:00
Don Cross
9e4fbecf55 JS: added OrbitalPeriod function. 2022-11-01 16:09:14 -04:00
Don Cross
6f25a3db85 Astronomy Engine v2.1.7: eclipse obscuration
This is my second attempt to release eclipse obscuration.
I discovered there was a missing unit test for obscuration
for lunar eclipses in the Kotlin library. It has been added.
2022-10-20 19:13:47 -04:00
Don Cross
232da2c319 Astronomy Engine 2.1.6: eclipse obscuration 2022-10-20 18:34:27 -04:00
Don Cross
223b75a69a JS: solar eclipse obscuration. 2022-10-19 16:47:33 -04:00
Don Cross
f6c5bd0bba JS: lunar eclipse obscuration 2022-10-19 14:37:21 -04:00
Don Cross
a9eadee3f1 Fixed #250 - handle years outside 0000..9999. 2022-10-06 22:05:44 -04:00
Don Cross
4a56f18325 Astronomy Engine version 2.1.4 2022-10-02 22:07:23 -04:00
Don Cross
c2bded8605 JS: Reverse chrono search for rise/set, hour angles.
The following JavaScript functions now support searching
in forward or reverse chronological order:

    SearchRiseSet
    SearchAltitude
    SearchHourAngle
2022-09-29 04:33:34 -04:00
Don Cross
add675ea09 C, TypeScript: code cleanup in Search function.
The quadratic interpolator used by `Search` was returning
an unused output: `x`. Search does not need this dimensionless
value; it only cares about the time solution `t` and the slope
of the function at `t`. Removed `x` from the return value
to make slightly smaller/faster code.
2022-09-27 17:14:36 -04:00
Don Cross
424b267007 JS SearchMoonPhase: allow searching backward in time.
Enhanced the JavaScript function Astronomy.SearchMoonPhase
to allow searching forward in time when the `limitDays`
argument is positive, or backward in time when `limitDays`
is negative.

Added unit test "moon_reverse" to verify this new feature.
2022-09-26 20:25:35 -04:00
Don Cross
d21ce79976 Updated version number to 2.1.3. 2022-09-22 10:25:47 -04:00
Don Cross
2a1abad0d5 Better use of package badges/links.
Provide shield.io badges for pypi, npm, and nuget packages.
On the main README page, moved the badges into the supported
languages grid.
Added link and badge on each language documentation page.
2022-06-05 12:42:00 -04:00
Don Cross
5e7162f08d GeoVector must return observation time.
Fixed 3 of the language implementations where I forgot
to make GeoVector return the observation time, not the
backdated time. This is important to preserve existing
behavior.
2022-05-31 21:26:03 -04:00
Don Cross
765c39d3fa JS: generalized light-travel time correction. 2022-05-30 19:27:25 -04:00
Don Cross
4303137c0a PY gravsim: initial coding completed
Finished coding the Python version of the gravity simulator.
No unit tests have been written yet.
Cleaned up documentation in the other languages.
Made some functions static that did not need to be members.
2022-05-22 09:41:44 -04:00
Don Cross
94589693f5 JS gravsim: finished unit tests, fixed bug
The JavaScript version of the gravity simulator is
now working. I had one bug in the acceleration formula.
Finished the unit tests and also streamlined them a little.
2022-05-19 09:49:37 -04:00
Don Cross
26575066fc JS gravsim: work in progress.
Mostly coded, but unit tests not written yet.
2022-05-18 19:52:11 -04:00
Don Cross
7b3c4a62f0 Fixed accidental merge noise in main README file. 2022-05-05 22:00:18 -04:00