Small additional improvements to orbit calculation #4784
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry for not noticing this right away. When the ship takes off from the planet, the eccentricity of its orbit is for some time in the range 0.9999 .. 1 and turns into a hyperbole 1.0001. The velocity vector is directed from the planet, so a line is drawn that goes from the ship to infinity. It is not right. These changes solve the problem.
Everything seems to be taken into account now. Feel free to kick.
Changes explained
Was:
orbit with 0.9999 < e < 1.0001 forced to e = 1.0001 (hyperbola)
Now:
orbit with 0.9999 < e < 1 forced to e = 0.9999 (ellipse)
orbit with 1 <= e < 1.0001 forced to e = 1.0001 (hyperbola)
In an elliptical orbit, when the eccentricity is fixed at 0.9999, and
the speed increases, the semi-major axis shrinks and the apocenter moves
toward the star. Therefore, a condition check has been added that prevents
the ship from shifting in this case.