mirror of
https://github.com/cosinekitty/astronomy.git
synced 2025-12-28 10:09:26 -05:00
Added an extra parameter `originBody` when creating a new gravity simulator. This defines the body center used as a coordinate origin for both input state vectors and output state vectors. This allows the caller to do everything in barycentric, heliocentric, geocentric, or planetocentric coordinates. This is important to avoid redundant calculations, since we already have to calculate most/all of the Solar System bodies anyway. Fixed a bug: the unit tests were not using the `option` parameter that was supposed to be passed to Astronomy_GravSimInit. It was always using the GRAVSIM_ALL_PLANETS option, which is why the tests always calculated the same answers. The way I was measuring error was a little dodgy. I reworked it to work without assuming anything about the struct layout of astro_state_vector_t in memory. I also always made it measure relative error converted into arcminutes, so it is easier for me to understand the numbers. There are still excessively large calculation errors that need to be debugged, so this is a work in progress. $ ./ctest gravsim C GravSimFile(0 : barystate/Ceres.txt ): PASS (count = 731, pos error = 1.8348 arcmin, vel error = 1.7127 arcmin) C GravSimFile(0 : barystate/Pallas.txt ): PASS (count = 731, pos error = 1.7055 arcmin, vel error = 1.3432 arcmin) C GravSimFile(0 : barystate/Vesta.txt ): PASS (count = 731, pos error = 1.5655 arcmin, vel error = 1.4338 arcmin) C GravSimFile(0 : barystate/Juno.txt ): PASS (count = 731, pos error = 1.1724 arcmin, vel error = 0.8732 arcmin) C GravSimFile(1 : barystate/Ceres.txt ): PASS (count = 731, pos error = 0.5821 arcmin, vel error = 0.5398 arcmin) C GravSimFile(1 : barystate/Pallas.txt ): PASS (count = 731, pos error = 0.4566 arcmin, vel error = 0.3327 arcmin) C GravSimFile(1 : barystate/Vesta.txt ): PASS (count = 731, pos error = 0.8185 arcmin, vel error = 0.7616 arcmin) C GravSimFile(1 : barystate/Juno.txt ): PASS (count = 731, pos error = 0.3206 arcmin, vel error = 0.2692 arcmin) C GravSimFile(2 : barystate/Ceres.txt ): PASS (count = 731, pos error = 0.5821 arcmin, vel error = 0.5398 arcmin) C GravSimFile(2 : barystate/Pallas.txt ): PASS (count = 731, pos error = 0.4566 arcmin, vel error = 0.3327 arcmin) C GravSimFile(2 : barystate/Vesta.txt ): PASS (count = 731, pos error = 0.8185 arcmin, vel error = 0.7616 arcmin) C GravSimFile(2 : barystate/Juno.txt ): PASS (count = 731, pos error = 0.3206 arcmin, vel error = 0.2692 arcmin) C GravSimFile(0 : heliostate/Ceres.txt ): PASS (count = 731, pos error = 0.0692 arcmin, vel error = 0.0659 arcmin) C GravSimFile(0 : heliostate/Pallas.txt ): PASS (count = 731, pos error = 1.0762 arcmin, vel error = 0.8765 arcmin) C GravSimFile(0 : heliostate/Vesta.txt ): PASS (count = 731, pos error = 4.6165 arcmin, vel error = 4.2126 arcmin) C GravSimFile(0 : heliostate/Juno.txt ): PASS (count = 731, pos error = 1.0013 arcmin, vel error = 0.7634 arcmin) C GravSimFile(1 : heliostate/Ceres.txt ): PASS (count = 731, pos error = 1.2524 arcmin, vel error = 1.1585 arcmin) C GravSimFile(1 : heliostate/Pallas.txt ): PASS (count = 731, pos error = 2.3224 arcmin, vel error = 1.8889 arcmin) C GravSimFile(1 : heliostate/Vesta.txt ): PASS (count = 731, pos error = 2.2375 arcmin, vel error = 2.0198 arcmin) C GravSimFile(1 : heliostate/Juno.txt ): PASS (count = 731, pos error = 0.4975 arcmin, vel error = 0.4193 arcmin) C GravSimFile(2 : heliostate/Ceres.txt ): PASS (count = 731, pos error = 1.2524 arcmin, vel error = 1.1585 arcmin) C GravSimFile(2 : heliostate/Pallas.txt ): PASS (count = 731, pos error = 2.3224 arcmin, vel error = 1.8889 arcmin) C GravSimFile(2 : heliostate/Vesta.txt ): PASS (count = 731, pos error = 2.2375 arcmin, vel error = 2.0198 arcmin) C GravSimFile(2 : heliostate/Juno.txt ): PASS (count = 731, pos error = 0.4975 arcmin, vel error = 0.4192 arcmin) C GravSimFile(0 : geostate/Ceres.txt ): PASS (count = 731, pos error = 6.5958 arcmin, vel error = 6.5102 arcmin) C GravSimFile(0 : geostate/Pallas.txt ): PASS (count = 731, pos error = 11.1674 arcmin, vel error = 8.7643 arcmin) C GravSimFile(0 : geostate/Vesta.txt ): PASS (count = 731, pos error = 10.6710 arcmin, vel error = 12.7938 arcmin) C GravSimFile(0 : geostate/Juno.txt ): PASS (count = 731, pos error = 7.3953 arcmin, vel error = 9.4322 arcmin) C GravSimFile(1 : geostate/Ceres.txt ): PASS (count = 731, pos error = 8.5754 arcmin, vel error = 8.4810 arcmin) C GravSimFile(1 : geostate/Pallas.txt ): PASS (count = 731, pos error = 13.2944 arcmin, vel error = 10.4513 arcmin) C GravSimFile(1 : geostate/Vesta.txt ): PASS (count = 731, pos error = 7.1130 arcmin, vel error = 8.4571 arcmin) C GravSimFile(1 : geostate/Juno.txt ): PASS (count = 731, pos error = 5.5835 arcmin, vel error = 7.0996 arcmin) C GravSimFile(2 : geostate/Ceres.txt ): PASS (count = 731, pos error = 8.5754 arcmin, vel error = 8.4810 arcmin) C GravSimFile(2 : geostate/Pallas.txt ): PASS (count = 731, pos error = 13.2944 arcmin, vel error = 10.4513 arcmin) C GravSimFile(2 : geostate/Vesta.txt ): PASS (count = 731, pos error = 7.1130 arcmin, vel error = 8.4571 arcmin) C GravSimFile(2 : geostate/Juno.txt ): PASS (count = 731, pos error = 5.5835 arcmin, vel error = 7.0996 arcmin) C GravitySimulatorTest: PASS (pos score = 13.2944 arcmin, vel score = 12.7938 arcmin)