-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor1.c
63 lines (54 loc) · 1.68 KB
/
color1.c
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
53
54
55
56
57
58
59
60
61
62
63
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mhedeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/10 10:57:19 by mhedeon #+# #+# */
/* Updated: 2018/08/20 17:14:37 by mhedeon ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
int dark(t_fract *fract, int i)
{
double v;
double t;
double a;
double b;
double d;
a = 0.5;
b = 0.5;
d = 0.49;
t = (double)i / (double)fract->max_itter;
v = a + b * cos(2.0 * M_PI * (t + d));
return (hsv2rgb(0, 0, v));
}
int lsd1(t_z *z, int i)
{
double h;
double mu;
mu = (double)(i + 1) - log2(log(z->mod));
h = 0.95 + 20.0 * mu;
if (h > 360)
h = (int)h % 360;
if (h < 0)
h = 360 - (int)-h % 360;
return (hsv2rgb(h, 0.9, 1));
}
int lsd2(t_fract *fract, t_z *z, int i)
{
double h;
double t;
double mu;
mu = (double)(i + 1) - log2(log(z->mod));
t = (double)i / (double)fract->max_itter;
h = fabs(cos(mu)) * 360;
return (hsv2rgb(h, t, 1));
}
int red(t_fract *fract, int i)
{
double t;
t = (double)i / (double)fract->max_itter;
return (hsv2rgb(359, 1, t));
}