2020-09-13 01:22:18 +00:00
|
|
|
#ifndef _COLOR_MATH_H
|
|
|
|
#define _COLOR_MATH_H
|
|
|
|
|
2020-10-17 11:23:48 +00:00
|
|
|
#include "math.h"
|
2020-10-14 15:57:34 +00:00
|
|
|
#include "time.h"
|
|
|
|
|
2020-10-17 11:23:48 +00:00
|
|
|
// These are macros so they can be applied to constants
|
|
|
|
#define DEGREES(rad) ((rad) * 180.0 / M_PI)
|
|
|
|
#define RADIANS(deg) ((deg) * M_PI / 180.0)
|
|
|
|
|
|
|
|
enum sun_condition {
|
|
|
|
NORMAL,
|
|
|
|
MIDNIGHT_SUN,
|
|
|
|
POLAR_NIGHT,
|
|
|
|
SUN_CONDITION_LAST
|
|
|
|
};
|
|
|
|
|
2020-10-14 15:57:34 +00:00
|
|
|
struct sun {
|
|
|
|
time_t dawn;
|
|
|
|
time_t sunrise;
|
|
|
|
time_t sunset;
|
|
|
|
time_t dusk;
|
|
|
|
};
|
|
|
|
|
2022-01-24 18:19:09 +00:00
|
|
|
struct rgb {
|
|
|
|
double r, g, b;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct xyz {
|
|
|
|
double x, y, z;
|
|
|
|
};
|
|
|
|
|
2020-10-19 11:18:07 +00:00
|
|
|
enum sun_condition calc_sun(struct tm *tm, double latitude, struct sun *sun);
|
2022-01-24 18:19:09 +00:00
|
|
|
struct rgb calc_whitepoint(int temp);
|
2020-09-13 01:22:18 +00:00
|
|
|
|
|
|
|
#endif
|