For a small game I'm working on I'm interested in simulating a basic celestial model for a planet, two moons and a sun. The main use is determining when specific eclipses happen and what type they are, but I figure it would be interesting to use it to determine sunrise and sunset as well.

I found the sunrise equation as well as this other question, but both go into far more detail than I need. I'm also having a lot of trouble wrapping my head around it. Every equation only seems to split into more equations, ad infinitum.

Since I'm using an extremely simplified model with nice, circular orbits I feel like there should be a relatively straightforward way to calculate (or approximate) the sunset/sunrise time based on the day of the year, but I'm having trouble seeing it.

The model I have so far is geocentric. Because I'm using circular orbs, I can easily determine the direction of the sun (in degrees) with (day_of_year / length_of_year) * 360°.

I can calculate the direction a point on the planet is facing similarly with (hour_of_day / length_of_day) * 360°, but that is only if the axial tilt is 0°.

For an axial tilt of 0°, I know that sundown/sunrise is when the sun is at 90° behind/ahead compared to the direction my location of interest is facing.

However, I'm stuck at how to figure in the axial tilt. I don't need an exact measurement, a rough approximation would be fine.

Any advice is appreciated!


1 Answer 1

  1. When using a geocentric model, as it is fit and proper to do in practical astronomy, the tilt belongs to the (apparent) orbit of the sun, and not to the world. In a geocentric model, the world is very obviously fixed and not tilted; it is the sun which is moving on a tilted orbit.

  2. Therefore when you calculate the position of the sun you must calculate two angles, one angle "around" (called right ascension) and one angle "up or down" (called declination), which will give you the equatorial coordinates.

  3. You must then convert the equatorial corrdinates into horizontal coordinates, azimuth and altitude, at the chosen station point. The sun rises when its altitude becomes positive and sets when its altitude becomes negative.

The canonical textbook is Practical Astronomy with your Calculator by Peter Duffett-Smith, with many editions between 1979 and 2017. (Recent editions add ...or Spreadsheet to the title, acknowledging that Microsoft Excel exists.) (Link goes to Amazon.)

The book covers topics such as time, coordinate systems, the Sun, planetary systems, binary stars, the Moon and eclipses. The third edition features new sections on generalised coordinate transformations, nutation, aberration, and selenographic coordinates. (Wikipedia.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .