Formulas to determine the illuminated phase and orientation of the Moon
The phase of the Moon (the bright limb) looks different depending on where on Earth the observer is located and the time of the observation. I've located this video and the accompanying spreadsheet that supposedly handles this sort of calculation, however I am somewhat confused on what formulas are actually used. I would greatly appreciate if someone with a bit more experience could decipher the spreadsheet a bit and perhaps write down or link me to the formulas being used.
I'm most interested in determining the illuminated phase (i.e the size of the bright limb) and the apparent orientation of the illuminated portion relative to the horizon. My goal is to understand how this type of calculation is done, in order to re-implement it in code for an application to use - displaying the typical crescent moon icon for night-time, but at the correct angle for a specific location and time.
PS! First post here, so I hope I have used the correct terminology for things.
EDIT: Eventhough the author of the spreadsheet left an answer to the topic, it doesn't feel like it really answers the question. Not to sound clueless and needy, but the question talks about formulas, which I know can be derived from the spreadsheet, however as I have no idea how to approach this, then the answer I was hoping for would help a bit more.
Well phase you could do with just a calendar. Orientation is a whole of a different matter though.
I created the spreadsheet. It's a bit complicated, to say the least. Initially I was inputting the formulas by hand from the book I cited in the video, but the process was rather error-prone so I ditched those tables and simply scanned the pages electronically and used the numbers from the scans to construct the tables of the Fourier series used to compute the moon's position. Some of the tables are therefore redundant and aren't used. You may be able to use a much simpler method to compute the position of the moon though; for my purposes I needed arcsecond accuracy. If all you're interested in is computing the approximate phase angle and apparent orientation you can get away with a much more simplified calculation for the moon's position that is accurate to within a few tenths of a degree. In that case the main thing you need from my spreadsheet are the formulas for computing the phase angle and apparent orientation. You'll need to calculate the approximate location of the sun as well in order to determine these things. The spreadsheet does this as well, using a simplified method described by Jean Meeus in "Astronomical Formulae for Calculators." He also gives a simplified method for computing the position of the moon. Either "Astronomical Formulae for Calculators" or "Astronomical Algorithms" (both by Jean Meeus) would be excellent references for your project. I can walk you through the formulas you need if you need help with that part.
I was hoping you could post the formulas here, unfortunately I don't have access to the listed books at the moment, so I am not able to read up on the topic. The formulas I have in mind would be the final ones (i.e I'll figure out the intermediate values as I go along), for example, how do you calculate the apparent orientation of the moon relative to the horizon?
The Moon's or a planet's bright limb orientation can be obtained by calculating the Position Angle of the Moon's Bright Limb. For detailed explanations and formula, you can see the following source:
Jean Meeus, Astronomical Algorithms, Secon Edition, 1998, PP 345-347
I hope it is useful for you after more than 6 years.