From 06ab6aa9040f31e39ebd587586b03639b49b64b3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Jul 2016 09:51:06 +0200 Subject: Add golden hour and blue hour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libred.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/libred.h b/src/libred.h index 81066a3..3cc2c86 100644 --- a/src/libred.h +++ b/src/libred.h @@ -50,6 +50,26 @@ */ #define LIBRED_SOLAR_ELEVATION_AMATEUR_ASTRONOMICAL_DUSK_DAWN (-15.0) +/** + * The Sun's lowest elevation during the golden hour, measured in degrees. + */ +#define LIBRED_SOLAR_ELEVATION_GOLDEN_HOUR_LOW (-4.0) + +/** + * The Sun's highest elevation during the golden hour, measured in degrees. + */ +#define LIBRED_SOLAR_ELEVATION_GOLDEN_HOUR_HIGH (6.0) + +/** + * The Sun's lowest elevation during the blue hour, measured in degrees. + */ +#define LIBRED_SOLAR_ELEVATION_BLUE_HOUR_LOW (-6.0) + +/** + * The Sun's highest elevation during the blue hour, measured in degrees. + */ +#define LIBRED_SOLAR_ELEVATION_BLUE_HOUR_HIGH (-4.0) + /** * Test whether it is twilight. @@ -107,6 +127,22 @@ */ #define LIBRED_IS_DAYTIME(ELEV) ((ELEV) > -32.0 / 60.0) +/** + * Test whether it is the golden hour. + * + * @param ELEV:double The current elevation. + * @return 1 if is golden hour, 0 otherwise. + */ +#define LIBRED_IS_GOLDEN_HOUR(ELEV) ((-4.0 <= (ELEV)) && ((ELEV) <= 6.0)) + +/** + * Test whether it is the blue hour. + * + * @param ELEV:double The current elevation. + * @return 1 if is blue hour, 0 otherwise. + */ +#define LIBRED_IS_BLUE_HOUR(ELEV) ((-6.0 <= (ELEV)) && ((ELEV) <= -4.0)) + /** * Calculates the Sun's elevation as apparent -- cgit v1.2.3-70-g09d2