forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make turn_zero constexpr * Add features to rl_vec3d * Construct from rl_vec2d and z-coord * Extract xy as rl_vec2d * In-place scaling * StringMaker support for rl_vec2d * Add StringMaker specialization for time_point * Add atan2( rl_vec2d ) overload * Add units::asin returning units::angle * Add sunlight angle calculation and tests This is an initial implementation of sunlight_angle, which should work OK for the first few days, but will break down before the end of the first year. One test plots the path of the sun through the sky at each solstice and an equinox. This is intended as a simple smell test that's easy for a human to see when something has gone wrong with the sun angle algorithm. * Add analemma unit test * Tweak sunlight calculation away from reality Because the game years don't match real-world years, we need to make some adjustments to the sunlight angle calculations to allow for that. * Use logical origin of sidereal time We had an origin of 177, but 180 makes logical sense, so switch to that as it's easier to understand. * Derive sidereal time from angle_per_day Removing one magic constant. * mean_long, mean_anomaly in terms of angle_per_day Remove more arbitrary constants from the calculation, and document those which remain. * Use game year length, not real-world one This removes one more arbitrary constant and means that the sunlight angle calculations ought to work for other season lengths. * Unit test for handling season length * Base sunrise and sunset on astronomical maths This is the first change that allows the sun angle calculations to actually influence the game. We switch the sunrise and sunset times to match the sun positions as calculated by the astronomical equations surrounding the location of the sun. This requires changing a few other places in the code, and updating a lot of tests. Heavinly inspired by Hirmuolio's work in CleverRaven#47570, but reimplemented rather than cherry-picked. Co-authored-by: Hirmuolio <[email protected]> * Support eternal season for new Sun calculations When eternal season is set, always have the Sun behave as it does on whatever day the game starts. * Update some comments in sun_test.cpp * Appease clang 3.8 * Improve comments and variable names Based on Github review. Co-authored-by: actual-nh <[email protected]> * Fix clang-tidy issues * Assume solar time rather than timezone Previously the sunlight angle code required you to pass a timezone. Now, instead, it assumes the timezone is local solar time (determined by the longitude). This makes some of the calculations simpler and the API less confusing. It does mean that the test cases have drifted a little further from the 'true' Boston sunrise and sunset times, but they're still fairly close. Co-authored-by: Hirmuolio <[email protected]> Co-authored-by: actual-nh <[email protected]>
- Loading branch information
1 parent
93ef036
commit 9eb435c
Showing
14 changed files
with
1,001 additions
and
433 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.