Commit Graph

4 Commits

Author SHA1 Message Date
Don Cross
f424bc14b5 Fixed bug in camera.js demo: incorrect angle for sunlit side of Moon. 2023-03-24 22:00:45 -04:00
Don Cross
0547aafc2b Made 'camera' demo checks tolerant of floating point roundoff.
The demo tests on Mac OS failed because of very tiny
floating point discrepancies that don't matter.
Changed the output of the "Moon check" so that slight
differences in vector residue no longer fail the unit tests.
2022-01-06 21:25:26 -05: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
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