Commit Graph

24 Commits

Author SHA1 Message Date
Don Cross
d7d68de068 Use light travel corrector in raytrace demo.
Simplified the Jupiter moon raytraced image demo
by using Astronomy_BackdatePosition to directly
calculate the vector while returning the backdated
time directly. This eliminates a redundant calculation
using the distance divided by the speed of light.
2022-06-01 18:41:25 -04:00
Don Cross
2247084943 C/C++: Jupiter's moons returned by name
It makes more sense to report Jupiter's moons with
individually named structure fields rather than an array.
It reduces the overall code and documentation size,
and outside of unit testing, there are few cases
where iterating over an array of moons is more
lucid than using the names of the moons.

This is a breaking change, but hopefully very few
developers are using this function yet.
Fixing the breakage is very simple.
2022-05-05 10:26:25 -04:00
Don Cross
0bfdb359b1 Fixed #153 - Optimize C functions by recycling nutation calculations.
Reduce the number of redundant Earth nutation calculations
by passing astro_time_t values as pointers in more functions.
Nutation values can then be cached in the time parameter
and passed to other functions that can then avoid calculating
the same nutation again.

Nutation is an expensive calculation, so reducing this overhead
can dramatically speed up certain use cases.

This was only needed in C, because this is the only language
in which times are passed by value. In Python, C#, and JavaScript,
times are objects that are already passed by reference, and
they already benefit from this nutation recyling approach.

The following functions have had their parameters changed.
This is a breaking change, but in every case, the caller
usually just needs to change `time` to `&time`.

    Astronomy_Rotation_EQD_EQJ
    Astronomy_Rotation_EQD_ECL
    Astronomy_Rotation_EQD_HOR
    Astronomy_Rotation_EQJ_EQD
    Astronomy_Rotation_EQJ_HOR
    Astronomy_Rotation_ECL_EQD
    Astronomy_Rotation_ECL_HOR
    Astronomy_Rotation_HOR_EQD
    Astronomy_Rotation_HOR_EQJ
    Astronomy_Rotation_HOR_ECL
    Astronomy_RotationAxis
    Astronomy_VectorObserver
2022-01-21 20:59:06 -05:00
Don Cross
862889f62f Raytracer: fix build warnings for macOS. 2022-01-07 17:17:25 -05:00
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
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
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
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
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
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