Commit Graph

2245 Commits

Author SHA1 Message Date
Don Cross
a23a3c7efb Raytracer: finished planet color table. 2022-01-03 19:56:18 -05:00
Don Cross
590218d139 Raytrace: fixed problem rendering Pluto.
Pluto is so far away that is angular size seen from Earth
is very small. I had to tweak my internal scaling constants
so that the raytracer was able to resolve it.
2022-01-02 20:47:28 -05:00
Don Cross
103e09d04c Raytracer: added radius data for other bodies.
Added radius data for the Sun, Moon, and remaining planets.
Test the raytracer for all other bodies except the Earth and Sun.
There is a problem with Pluto that I still need to figure out.
Fixed an issue in the doxygen-to-markdown translator I wrote
(hydrogen.js): it did not handle when one #define referred
to another #define. Created a more generic markdown expansion
that works in all cases, and creates embedded hyperlinks.
2022-01-02 20:32:45 -05:00
Don Cross
2277b5c26d Raytrace: Refactor scale constants to be global. 2022-01-02 19:20:22 -05:00
Don Cross
8a95ff0ee3 Raytrace: Default to auto-spinning the planet. 2022-01-02 19:05:16 -05:00
Don Cross
4fee2659da Raytracer: auto-zoom to planet's angular diameter. 2022-01-02 17:18:14 -05:00
Don Cross
7a3d1bd085 Jupiter raytrace: factor out code for adding moons. 2022-01-01 19:59:24 -05:00
Don Cross
6aac859020 Saturn raytrace: forgot to orient the planet's equator. 2022-01-01 19:36:48 -05:00
Don Cross
e158dab271 Raytrace: Added Saturn. Updated copyrights for 2022.
Added Saturn and its rings to the raytrace demo.

As a side effect of running the unit tests, copyrights
got updated for 2022. Happy New Year!
2021-12-31 22:25:16 -05:00
Don Cross
c86445ccce Mac fix: eliminate 'realpath' from makedoc script.
The program 'realpath' does not come installed on Mac OS.
This caused the bash script 'makedoc' to fail on Mac.
The only place I used realpath was to convert relative
paths to absolute paths for filenames passed to
check_internal_links.py.

It turns out Python has a standard function os.path.realpath()
that does the same thing, so I moved the logic into the
Python script itself. Thus makedoc no longer needs the
realpath program, and the Python function will work on
all platforms.

There is a general lesson here: in the future I will
consider moving more of my scripting logic into Python.
It has proven to be more portable than a mixture
of bash scripts and Windows batch files.
2021-12-30 11:08:09 -05:00
Don Cross
5dbd6ea612 Fixed another abs() warning in novas.c.
There was one more place where novas.c calls abs()
that caused a warning when compiled on the Mac.
It was passing long int to abs(). To be abundantly
cautious, instead of using labs(), I just manually
check for negative values and toggle -- inline abs.
2021-12-30 11:05:19 -05:00
Don Cross
51c6f6a591 Fixed warnings in novas.c on Mac builds.
I received a report that there are compiler warnings
that break the build in novas.c when building on the Mac.
In two cases, long integers are passed to abs(), which expects
its argument to be int. The warnings broke the build
of the 'generate' program. I patched the code so these
warnings should no longer occur, though I do not have a
Mac to test. Will ask the correspondent to test for me.
2021-12-29 14:48:25 -05:00
Don Cross
8731f1d229 Raytracer: started to generalize planet imager.
Refactored the Jupiter imager to be a generic planet imager.
Added support for drawing an image of Venus.
Verified that its extreme crescent phase looks correct
for the current date.
I will add radius constants to astronomy.h for each body I support.
2021-12-28 20:45:55 -05:00
Don Cross
3502906204 Raytracer: added -v option to print verbose messages. 2021-12-28 19:54:35 -05:00
Don Cross
1de7085ac2 Raytracer: auto-rotate image for planet's axis.
The raytracer now includes the option -s (without a numeric
spin angle on the command line) to automatically calculate
the spin angle needed to bring the planet's north pole
exactly upward in the generated image.
2021-12-27 21:37:52 -05:00
Don Cross
082194d2b6 Jupiter raytracer: better rotation matrix.
Improved the way I create the rotation matrix that
aims the virtual camera at Jupiter. The camera still
aims exactly at Jupiter, but this time it defaults
to having the left/right pixel direction aligning
with the Earth's equator. By experiment, I can spin
the longitudinal camera axis by -10 degrees and get
a good fit with Jupiter's equatorial plane. I will
adjust this more exactly in a future commit.
2021-12-20 21:44:58 -05:00
Don Cross
e57dd0a26b Added aim test sanity check in raytracer.
Instead of just printing both unit vectors that should be the same,
actually check that they point the same direction with a very
tight tolerance.
2021-12-19 21:33:34 -05:00
Don Cross
70489c3dc6 Raytracer: allow specifying non-square images.
Now the raytracer requires the user to pass in
both the pixel width and pixel height on the command line.
This allows for generating non-square images, which will
be necessary for the general case of imaging the moons
with respect to the planet.
2021-12-19 17:27:33 -05:00
Don Cross
707382aaf2 Raytracer: minor coding style fixes. 2021-12-18 17:27:36 -05:00
Don Cross
51260bcbc1 Raytracer: modernized C++ iterator loops. 2021-12-18 17:23:01 -05:00
Don Cross
60728cf8b5 Raytracer: eliminated unnecessary class Optics.
Now that I have eliminated refraction and reflection
from the astronomy raytracer, there is no need for an
Optics class that represents matte, gloss, and index
of refraction.
2021-12-18 17:12:04 -05:00
Don Cross
503ee86bef Removed more fossils from the raytracer. 2021-12-18 17:05:27 -05:00
Don Cross
05db236ae1 Removed reflection and refraction from raytracer.
Reflections and transparent refractions are not needed
for planet images. I removed all this unnecessary code.
2021-12-18 16:53:22 -05:00
Don Cross
8ef54a58cf More efficient raytrace of Jupiter's moons.
Model Jupiter's moons using the Sphere class, rather
than the Spheroid class. Sphere is more efficient
to calculate.
2021-12-18 16:43:29 -05:00
Don Cross
216f2628d8 Trimmed more stuff from raytracer. 2021-12-18 16:35:00 -05:00
Don Cross
8ae0b7e16c Trimmed some debug code from the raytracer. 2021-12-18 16:23:20 -05:00
Don Cross
c93df6d4d4 Add raytracer test to the demo tests.
Verify that the raytracer builds and runs without error.
2021-12-15 20:04:45 -05:00
Don Cross
232cc9480b Added spin and zoom options to Jupiter raytracer. 2021-12-15 19:32:38 -05:00
Don Cross
cfe633af8f Allow flipping the raytraced image.
The raytracer now accepts a -f option to
flip the image, to match the inverted view
through some telescopes.
2021-12-15 19:15:17 -05:00
Don Cross
680fb48627 I had incorrect date/time for the Jupiter image.
I went back and discovered I made an error
converting local time to UTC when I calculated
the Jupiter raytrace image. Now it matches the
actual photo.
2021-12-14 21:40:26 -05:00
Don Cross
415d1c57d1 Fixed raytracer problems due to numeric scale.
I had lots of problems with using AU as my scale units.
By changing to 10000*km units, the vector equation solver
works correctly again, and I actually get an image of Jupiter
and its moons. However, it does not match the test photo:
Ganymede does not appear close to the planet, nor is there
a shadow of it on the planet. I will have to debug that
separately.
2021-12-14 20:35:42 -05:00
Don Cross
bc93faeb04 More work in progress: Jupiter imager.
Starting to work through adaptation of existing
raytracer code to generate geometrically accurate
images of Jupiter and its moons. Not yet working,
but I believe I am at least aiming the camera in
the right direction.
2021-12-13 21:00:04 -05:00
Don Cross
88a1ab7290 Work in progress: Jupiter raytracer. 2021-12-13 16:37:10 -05:00
Don Cross
210319d407 Python documentation fixes.
The documentation for the Python function `SearchAltitude`
was missing a mention of the `altitude` parameter.
I searched for similar mistakes in Python, C#, and C,
having just completed the same exercise in the JavaScript code.

I also found several places where extraneous newlines
between the parameter documentation caused the Markdown
to be rendered incorrectly.
2021-12-10 20:32:43 -05:00
Don Cross
7448727549 Fixed #143 - Fixed JS documentation mistakes.
Added documentation about the missing `date` parameter
to the `Elongation` function in the JavaScript version.
I reviewed all the other JavaScript functions to make sure there
were no other similar mistakes with parameters or return types.

Along the way, I discovered and fixed some other issues:

Fixed miscellaneous typos in the documentation.

Consistently refer to enumeration values like `Body.Earth`
instead of strings like `"Earth"`. I want to encourage
use of the enumerations because they make type-checking easier,
especially for TypeScript code.

Reworked `AstroTime` parameters to `FlexibleDateTime` parameters
in all exported functions. This is completely backward-compatible,
and allows callers more flexibility with passing `AstroTime`,
`Date`, or numeric day values.
2021-12-10 19:16:10 -05:00
Don Cross
82a4d2c996 Starting to work on a rendering demo of Jupiter and its moons. 2021-12-09 21:43:34 -05:00
Don Cross
3c69959606 Render Astronomy Engine logo with consistent aspect ratio. 2021-12-09 20:27:28 -05:00
Don Cross
f0ab974452 Display Astronomy Engine logo on the front page. 2021-12-08 22:25:39 -05:00
Don Cross
2a418bcf77 Uploading new logo. 2021-12-08 22:22:24 -05:00
Don Cross
f994d8d04c Fixed #141 - Upgrade C# code to .NET 6.
Now that Microsoft has officially released .NET 6,
I have upgraded the C# version of Astronomy Engine to use it.
No source code changes were needed. I just bumped the
version number in the project files, and targeted .NET 6
in the GitHub Actions continuous integration tests.
Fixed some obsolete wording in generate/README.md.
2021-12-07 17:06:04 -05:00
Don Cross
945e70a98f Fixed #106 - Calculate rotation axis of Sun, Moon, and planets. 2021-12-07 15:31:54 -05:00
Don Cross
e6c28a9a40 C: Found much more accurate Moon axis formulas.
I went back to the 2009 version of the IAU paper at:
https://astropedia.astrogeology.usgs.gov/alfresco/d/d/workspace/SpacesStore/28fd9e81-1964-44d6-a58b-fbbf61e64e15/WGCCRE2009reprint.pdf
and found formulas for the Moon's rotation axis and spin angle.
The north pole vector agrees with JPL Horizons to within 0.26 arcminutes,
which is much better than the 5.7 arcminutes I was getting using my
own formulas. So now I believe I'm ready to start porting the formulas
to the other 3 languages (C#, JavaScript, Python).
2021-12-07 14:10:24 -05:00
Don Cross
919973e11d Slight changes to moon axis calculation.
Added more test data for the Moon axis to better cover its orbital motion.
Tweaked the polar axis inclination to better match the test data.
2021-12-06 20:18:44 -05:00
Don Cross
a652da7b9e Rough version of Moon's rotation axis in C.
I used Cassini's Laws to derive an approximate solution
to the Moon's rotation axis. The error is on the order of
5 arcminutes. I still need to correct for physical libration.

I also need to find test data for the Moon's prime meridian
so that I can implement the spin angle calculation.
(I could use test data for all the planets' spins, for that matter.)
2021-12-05 13:22:00 -05:00
Don Cross
6cfd5d467b Fix generating markdown docs for Python.
In Windows I am running Python 3.7.8.
For some reason, it fails to write Unicode Greek letters
I use in the Markdown documentation unless I explicitly
specify to use utf-8 encoding. I thought that was the default,
because it works fine in Linux running 3.9.2.
I'm not sure whether the issue is due to Windows or
to a change in the Python version. Regardless, I am
explicitly specifying the file encoding to make the
documentation translator I wrote (pydown.py) work.
2021-12-03 22:25:53 -05:00
Don Cross
bbffebf88c Merge branch 'master' into axis 2021-12-03 21:51:54 -05:00
Don Cross
0ab6ac0cae Fixed Windows build issue in makedoc.bat.
This issue affected maintainers (mostly me) only.
Developers who are using Astronomy Engine do not need
to worry about this.

Running the source generator on Windows was broken because
I forgot to copy a step over from the Linux build that
prevents building tutorial pages in the master branch.
I didn't notice this until now because makedoc.bat also
had a bug where it detected an error but did not stop
execution... it just kept going and made it hard to
notice something was wrong.
2021-12-03 21:40:05 -05:00
Don Cross
f4297b78ae Added NASA moon libration data for 2022.
Moon libration data from NASA is now available for the
2022 calendar year. I added it to the existing libration
unit tests.
2021-12-03 16:31:21 -05:00
Don Cross
c36f16e1be PY RotationAxis function. 2021-12-02 16:11:50 -05:00
Don Cross
4235ee1715 JS RotationAxis function. 2021-12-01 21:26:29 -05:00