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

Add a simplified and commented TimeToPlane algorithm #1253

Closed
wants to merge 1 commit into from

Conversation

dzhu
Copy link

@dzhu dzhu commented Apr 6, 2020

This change replaces the previous implementation of TimeToPlane with a new one that is simpler and more commented.

It also fixes a bug in the handling of LANDifference: because LANDifference was subtracted as the very last step in the angle computations, a positive value could cause the output of TimeToPlane to be negative, leading to an immediate launch even when that was not correct.

(I'm not sure LANDifference is being set in the most useful way to begin with; it seems to always be better to leave it at 0 than use the value MJ fills in after a launch. But that's a separate discussion.)

Also, there is now a special case for very low inclinations (<.01 degrees); since there's such a small difference between different launch times, the function now just returns 0. The old implementation always returned a launch point 90 degrees away when the inclination was exactly 0.

This change replaces the previous implementation of `TimeToPlane` with a
new one that is simpler and more commented.

It also fixes a bug in the handling of `LANDifference`: because
`LANDifference` was subtracted as the very last step in the angle
computations, a positive value could cause the output of `TimeToPlane`
to be negative, leading to an immediate launch even when that was not
correct.

Also, there is now a special case for very low inclinations (<.01
degrees); since there's such a small difference between different launch
times, the function now just returns 0. The old implementation always
returned a launch point 90 degrees away when the inclination was exactly
0.
@lamont-granquist
Copy link
Collaborator

I actually cleaned that one up months ago on a branch I never pulled due to other issues with it.

I just rescued that in PR #1260, can you look at that and see if it works? Its a little more extensive than what you had, and I just use one of napier's analogies from spherical trig to solve the problem (which is why I kind of prefer that solution since its just using a prebaked spherical trig algorithm and doesn't require any exposition or proof).

@lamont-granquist
Copy link
Collaborator

replaced by #1260

@dzhu
Copy link
Author

dzhu commented Apr 20, 2020

Oh neat, that's some cool math.

@lamont-granquist
Copy link
Collaborator

Yep, mathematicians already solved that one, I just needed to teach myself enough spherical trig to figure out which formula was simplest to apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants