Commit Graph

2227 Commits

Author SHA1 Message Date
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
349e340997 Added nodejs demo for calculating equatorial coordinates from horizontal coordinates. 2021-03-27 20:47:46 -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
a97fc7da9c Ported IdentityMatrix, Pivot functions to Python. Added tests and camera demo. 2021-03-27 05:19:27 -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
7241322364 Added C# demo for camera orientation.
Added a C# demo program camera.cs that works the same way
as the C demo program camera.c.

I realized I can speed up the C# demo tests by directly
running the executables after I build them, instead of using 'dotnet'.

Added 'vec' field to Equatorial class. I just realized I no longer need
the function VectorFromEquator(), because the vector is now available
as 'vec'. I will get rid of it in another commit.
2021-03-24 19:38:50 -04:00
Don Cross
4791474271 Updated C and C# topic indexes to include IdentityMatrix, Pivot. 2021-03-23 21:37:50 -04:00
Don Cross
d2d54c9ae2 Implemented C# functions IdentityMatrix and Pivot.
Created new rotation matrix functions for the C# version.
IdentityMatrix creates a new instance of the 3x3 identity matrix

1 0 0
0 1 0
0 0 1

Pivot transforms a rotation matrix by pivoting it about
one of its coordinate axes by a specified angle.

Still need to port the C version of the "camera" demo.
2021-03-23 20:48:33 -04:00
Don Cross
9eeafc4d16 Updated camera.c demo to print magnitude, phase angle, and Sun angle. 2021-03-23 19:37:49 -04:00
Don Cross
f40f4cfbcc More rigorous tests for C Astronomy_Pivot.
Exercise rotation around all three axes for the C function Astronomy_Pivot,
and verify that the actual rotation on a non-unit vector (1, 2, 3)
is as expected.
2021-03-23 13:47:29 -04:00
Don Cross
fcd6ec4d05 Starting to work on support for camera orientation in the C version.
Added C function Astronomy_Pivot to transform a rotation matrix
by rotating it around one of its coordinate axes by a given angle.

Added C function Astronomy_IdentityMatrix that just returns
an identity matrix that can be used as the starting point in
a series of transforms.

C function Astronomy_Equator now also returns the topocentric
equatorial location in the form of a cartesian vector.
This is in a new member of the astro_equatorial_t struct
called 'vec'.

The unit test in ctest.c "Rotation_Pivot()" could be improved
with more and better tests.

Created a demo program camera.c that illustrates using
Astronomy_Pivot() to help calculate the tilt of the sunlit
side of the Moon, as seen by a camera pointing right at it.
The resulting tilt angle is not yet verified.
I need to have some confirmation that it is correct before
porting to the other languages.
2021-03-22 22:30:04 -04:00
Don Cross
5707babbf8 Removed remnants of old debugging code.
I had a bug back in May 2020 that turned out to be in
generate.c unit tests, not in published Astronomy Engine code.
I have long since fixed these bugs, but I still had fossil
test code sitting around that doesn't work any more and
isn't needed. Deleted it.
2021-03-20 20:21:36 -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
Don Cross
cb50beb217 Deleted obsolete build script apply_exports_hack.py.
This script was a hack used to make the JavaScript code
work on both Node.js and in browsers. Now we build separate
versions of the code for both environments, so we no longer
need this script.
2021-03-06 16:26:11 -05:00
Don Cross
a8c970ba78 Updated npm package version to 2.0.1 in documentation. 2021-03-01 12:23:27 -05:00
Don Cross
2e96f79813 Merge pull request #89 from matheo/fix/typings
Include typings in the package.json.
2021-03-01 11:58:17 -05:00
Mateo Tibaquira
38ac8e1f88 build: include typings in the package.json 2021-03-01 08:58:50 -05:00
Don Cross
3a1d4ea47a Merge pull request #87 from matheo/docs/fix-settings
Docs: settings adjustments for Netlify
2021-02-26 17:34:01 -05:00
Mateo Tibaquira
d6a0623fce build: add netlify redirect settings 2021-02-26 17:21:29 -05:00
Mateo Tibaquira
ab35523775 docs: remove usage of hashes for routing 2021-02-26 17:21:29 -05:00
Mateo Tibaquira
aa0291dc75 docs: fix base-href to the root of the domain 2021-02-26 17:21:22 -05:00
Don Cross
4d5f4453e9 Merge pull request #85 from matheo/initial-docs
Docs: glossary placeholders
2021-02-26 16:32:43 -05:00
Mateo Tibaquira
2e310a7e7f build: remove the compiled website from the repo 2021-02-26 12:07:47 -05:00
Don Cross
0eb35d6137 Ported recent JavaScript build changes to Windows.
Updated the Windows batch file makedoc.bat to reflect
recent changes to the build process in Linux.

Using npm packages and build process to transpile
TypeScript to JavaScript, and to minify that JavaScript.
Generating separate js files for Node and the browser.

The only quirk is the file website\src\assets\documentation.json
does not exactly match.
2021-02-10 21:49:42 -05:00
Mateo Tibaquira
f48f2a4d87 build(docs): update compiled github pages 2021-02-09 23:30:14 -05:00
Mateo Tibaquira
5e40c7c0c1 docs(glossary): placeholder components for each section 2021-02-09 23:29:16 -05:00
Mateo Tibaquira
3c27345448 docs(demos): componetize the layout as shared components 2021-02-09 20:06:45 -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
Don Cross
1e1ed312df Decreased size of Acknowledgements header. 2021-02-09 13:09:36 -05:00
Don Cross
4bdcbfe36d Added "Deploys by Netlify" badge to README.md. 2021-02-09 13:08:12 -05:00
Don Cross
44137e4dc3 Merge pull request #84 from matheo/initial-docs
JS: Library capable of tree-shaking
2021-02-08 21:56:22 -05:00
Mateo Tibaquira
433a985b6f demos: improved valildation of body-position form 2021-02-08 20:12:53 -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
7449ff4be0 Merge pull request #82 from matheo/initial-docs
Initial documentation website
2021-02-08 17:33:57 -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
Don Cross
85e3a36000 JS unit test should use the Node version of astronomy.js, not the browser version.
Now that we generate separate JavaScript code for Node.js and the browser,
the unit test should use the minified Node version.

It's interesting that the test works equally well with either file.
Perhaps we should consider exercising both in the unit tests?
2021-02-08 09:37:33 -05:00
Don Cross
129a3ccdc5 Merge pull request #83 from matheo/typescript
JS: Refactor typescript build process
2021-02-08 09:00:40 -05:00
Mateo Tibaquira
a0946fab37 build: website bundle for GitHub pages 2021-02-08 02:10:34 -05:00
Mateo Tibaquira
3fd9022fdc demos: initial port of celestial body positions 2021-02-08 02:06:20 -05:00
Mateo Tibaquira
57d74555d7 JS: Fix JSON documentation removing absolute paths 2021-02-08 02:06:04 -05:00
Mateo Tibaquira
958f8b0ddc JS: Fix docblock for SearchOptions 2021-02-07 23:46:01 -05:00