Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t plot all celestials all the time #3276

Merged
merged 6 commits into from
Jan 11, 2022

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Jan 8, 2022

Related to #3035.
This uses the hierarchical Keplerian structure of celestials to only plot those that could be visibly separated from their primary at some point along the plotted trajectory.

On a sample 50ish-year trajectory flying by Jupiter and Neptune, looking at the Neptune flyby in Neptune-Sun-Orbit, the framerate goes from 2 to 8 FPS; looking at the Jupiter flyby in Jupiter-Sun-Orbit, from 2 to 4 FPS.

The following table lists the bodies plotted in various situations in RSS, with multi-year trajectories:

Reference frame & camera position Bodies plotted
ECEF or ECI, near the Earth Sun, Mercury, Venus,
(Earth), Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
HCI above the ecliptic,
FoV ≈ orbit of Earth
(Sun), Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
HCI above the ecliptic,
FoV ≈ orbit of Mars
(Sun), Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
HCI above the ecliptic,
FoV ≈ orbit of Jupiter
(Sun), Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
HCI above the ecliptic,
FoV ≈ orbit of Saturn
(Sun), Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
HCI above the ecliptic,
FoV ≈ orbit of Uranus
(Sun), Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
Neptune, Triton,
Pluto, Charon
Neptune-Sun-Orbit, near Neptune Sun, Mercury, Venus,
Earth, Moon,
Mars, Phobos, Deimos,
Vesta, Ceres,
Jupiter, Io, Europa, Ganymede, Callisto,
Saturn, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus,
Uranus, Miranda, Ariel, Umbriel, Titania, Oberon,
(Neptune), Triton,
Pluto, Charon

ksp_plugin/planetarium.cpp Outdated Show resolved Hide resolved
@@ -236,6 +244,12 @@ RP2Lines<Length, Camera> Planetarium::PlotMethod2(
continue;
}

if (minimal_distance != nullptr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do that all the time? It's not overly costly and it would make the code a bit simpler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like trading a well-predicted branch for a poorly-predicted one; if we weren’t trying to optimize the square roots by working with squared distances, we would need a null check anyway.

ksp_plugin_adapter/ksp_plugin_adapter.cs Outdated Show resolved Hide resolved
ksp_plugin_adapter/ksp_plugin_adapter.cs Outdated Show resolved Hide resolved
ksp_plugin_adapter/ksp_plugin_adapter.cs Outdated Show resolved Hide resolved
@pleroy pleroy added the LGTM label Jan 9, 2022
@eggrobin eggrobin merged commit dce765b into mockingbirdnest:master Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants