CelestiaProject / Celestia

Real-time 3D visualization of space.
https://celestiaproject.space
GNU General Public License v2.0
1.8k stars 304 forks source link

Select/Goto planets orbiting other star components in binary/multiple systems #1452

Open arbodox opened 1 year ago

arbodox commented 1 year ago

Normally in Celestia, you wouldn't be able to use the Navigation Select or Goto options for any extrasolar object (defined in .ssc) without selecting their host star first. This also applies to any multiple star system where each star component orbits a barycenter and has planets of its own. Unfortunately, this poses a limitation on the ease of travel between the planetary systems of the star components. Let me set up an example:

Let's say you have a binary system of two stars, A and B, orbiting a single barycenter, X. Each of the three entities (A, B, and X) has one planet orbiting around it, so there is one planet around star A, one planet around star B, and one planet around barycenter X. If you have selected the planet of A, you cannot use the Navigation Select or Goto options for planet B and planet X. Likewise, if you have selected planet B, you cannot select planet A and X.

Interestingly, the ability to select an object works in a top-down hierarchical order: when you have barycenter X or planet X selected, you are able to select both planets A and B. However, if you select one of the stars or star-orbiting planets, you cannot select the other star-orbiting planet and the barycenter-orbiting planet X.

Here is a test addon that demonstrates this scenario by adding fictitious planets to Alf Cen A, B, and the Alf Cen barycenter: https://cdn.discordapp.com/attachments/419000686466957312/1038520070252540074/example_addon.ssc

Another example where this planet selection limitation applies is the Solar System Barycenter (SSB), which is treated as a separate system from the Sun despite the Sun orbiting the SSB. As a result, you cannot select any objects orbiting the SSB if you're already selecting an object orbiting the Sun.

To resolve this limitation, I would like to have all planetary objects in multiple systems selectable and travellable if you've already selected an object or star that is part of the system.

eehikki commented 8 months ago

This problem could be solved by employing some kind of B-trees, where objects are sorted by their masses. But mass isn't a mandatory attribute of celestial bodies in Celestia; information about mass is an optional field and it's intended to be human-readable rather then software-usable (correct me if I`m wrong). Mass could be approximated by some heuristics, but these heuristics seem to be quite complex

ajtribick commented 8 months ago

I don't think we need to start using mass here - we could in principle do this by walking the existing barycenter tree, although this would not work for cases like Alpha Cen/Proxima, where the stars are defined as separate entities with no relationship to each other.

The other slight wrinkle is that historically Celestia has used single-character exoplanet names, e.g. "b", which appear in a lot of systems. I am not sure there yet exists an actual case of a binary system with known orbit, with planets orbiting both stars but any implementation would need to take care that selecting "b" does not go to the other star.