aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-07 09:51:06 +0200
committerMattias Andrée <maandree@kth.se>2016-07-07 09:51:14 +0200
commit06ab6aa9040f31e39ebd587586b03639b49b64b3 (patch)
tree6746bed496649acadcdf7a7ae23ee9812ba0fa99
parentAdd daytime and nighttime test (diff)
downloadlibred-06ab6aa9040f31e39ebd587586b03639b49b64b3.tar.gz
libred-06ab6aa9040f31e39ebd587586b03639b49b64b3.tar.bz2
libred-06ab6aa9040f31e39ebd587586b03639b49b64b3.tar.xz
Add golden hour and blue hour
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/libred.h36
1 files changed, 36 insertions, 0 deletions
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