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

Lat/Lon from subpoint #182

Closed
dieli opened this issue Jun 7, 2018 · 5 comments · Fixed by #186
Closed

Lat/Lon from subpoint #182

dieli opened this issue Jun 7, 2018 · 5 comments · Fixed by #186
Assignees

Comments

@dieli
Copy link
Contributor

dieli commented Jun 7, 2018

In the function to get lat/lon of a subpoint, the reverse_terra function is called. I have looked at the code and think that this could lead wrong values in case the arctan2 function returns a negative value (for lon).
lon = (arctan2(y, x) - 15 * DEG2RAD * gast) % tau
Replacing above line with:
lon = (((arctan2(y, x) - 15 * DEG2RAD * gast) + tau / 2.0) % tau) - tau / 2.0
should fix the issue. Output will then be +/-pi

Am I wrong here?

see dieli#1

@dieli
Copy link
Contributor Author

dieli commented Jun 7, 2018

The conversion to lon is the same on the ellipsoid as for the sphere. For latitude the formula as stated in https://www.celestrak.com/columns/v02n03/ is implemented. I am more concerned about the modulo operation, when the arctan2 function returns negative values.

@davidmikolas
Copy link

Okay thanks. I'll delete my comment as it's tangential (no pun intended)

@brandon-rhodes brandon-rhodes self-assigned this Jun 16, 2018
@AlanMilford
Copy link

Can confirm the fix from @dieli fixes erroneous longitude values I've been experiencing.

@brandon-rhodes
Copy link
Member

I've merged the pull request — thanks!

@brandon-rhodes
Copy link
Member

(I'm not sure why I thought % tau was good for longitude. I must be too used to Right Ascension!)

brandon-rhodes pushed a commit that referenced this issue Jul 2, 2018
Fixes #182: longitude should be forced into the range [–𝜋, 𝜋).
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 a pull request may close this issue.

4 participants