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

Draw sublunar point on ptr world map #139

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

LTDakin
Copy link
Contributor

@LTDakin LTDakin commented Jan 9, 2024

Draws the moon to the world map on the ptr home screen

using an good enough equation supplied by Tim Lister -> https://stjarnhimlen.se/comp/tutorial.html#7.
Tested against this website to check accuracy -> https://www.timeanddate.com/worldclock/sunearth.php

Hard to test since I don't understand the math too much, so will keep an eye on it for a week to make sure it stays accurate and no errors come up.

Screenshot 2024-01-09 at 1 53 56 PM

@LTDakin LTDakin added the enhancement New feature or request label Jan 9, 2024
capetillo
capetillo previously approved these changes Jan 9, 2024
Copy link
Contributor

@capetillo capetillo left a comment

Choose a reason for hiding this comment

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

Great work! Big math behind it. Good for you for crushing it!

@capetillo capetillo self-requested a review January 9, 2024 23:48
Copy link
Contributor

@capetillo capetillo left a comment

Choose a reason for hiding this comment

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

I had approved before, but the moon isn't moving.

const normalizedM = rev(M + 129 * 360);

// Compute eccentric anomaly (E)
let E0 = normalizedM + (180 / Math.PI) * e * Math.sin(normalizedM) * (1 + e * Math.cos(normalizedM));

Choose a reason for hiding this comment

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

I thought javascript Math.sin() etc used radians rather than degrees

const E = E1;

// Rectangular coordinates in the plane of the lunar orbit
const x = a * (Math.cos(degToRad * E) - e);

Choose a reason for hiding this comment

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

Yeah, this looks right - converting degrees to radians before taking the cosine

@LTDakin
Copy link
Contributor Author

LTDakin commented Jan 10, 2024

Ah I see why it's not working. This formula gives ecliptic longitude and latitude when I need to get earth coordinates. Will look for a formula for that or ask Tim again.

@LTDakin LTDakin dismissed capetillo’s stale review January 10, 2024 00:51

it dont work, also I've never clicked this button so want to see what it does

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

Successfully merging this pull request may close these issues.

3 participants