-
Notifications
You must be signed in to change notification settings - Fork 86
/
helpers.h
52 lines (37 loc) · 1.24 KB
/
helpers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef HELPERS_H
#define HELPERS_H
#include <stdint.h>
#include "rng-double.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define ROUND(x) ((int) ((x) + 0.5))
#define SIGN(x) ((x)>0?1:(-1))
#define SQR(x) ((x)*(x))
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define MAX3(a, b, c) ((a)>(b)?MAX((a),(c)):MAX((b),(c)))
#define MIN3(a, b, c) ((a)<(b)?MIN((a),(c)):MIN((b),(c)))
#define WGM_EPSILON 0.001
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
void
hsl_to_rgb_float (float *h_, float *s_, float *l_);
void
rgb_to_hsl_float (float *r_, float *g_, float *b_);
void
hsv_to_rgb_float (float *h_, float *s_, float *v_);
void
rgb_to_hsv_float (float *r_ /*h*/, float *g_ /*s*/, float *b_ /*v*/);
void
hcy_to_rgb_float (float *h_, float *c_, float *y_);
void
rgb_to_hcy_float (float *r_, float *g_, float *b_);
float rand_gauss (RngDouble * rng);
float mod_arith(float a, float N);
float smallest_angular_difference(float angleA, float angleB);
float * mix_colors(float *a, float *b, float fac, float paint_mode);
void
rgb_to_spectral (float r, float g, float b, float *spectral_);
void
spectral_to_rgb (float *spectral, float *rgb_);
#endif // HELPERS_H