-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor2.c
63 lines (55 loc) · 1.84 KB
/
color2.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mhedeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/15 23:20:32 by mhedeon #+# #+# */
/* Updated: 2018/08/20 17:15:04 by mhedeon ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
int toxic1(t_fract *fract, int i)
{
double h;
double t;
t = (double)i / (double)fract->max_itter;
h = (9.0 * (1.0 - t) * t * t * t * 255.0);
h = h / 255 * 360;
return (hsv2rgb(h, t, 1));
}
int toxic2(t_fract *fract, int i)
{
double h;
double t;
t = (double)i / (double)fract->max_itter;
h = fabs(sin(t)) * 360;
return (hsv2rgb(h, t, 1));
}
int toxic3(t_fract *fract, int i)
{
double h;
double t;
t = (double)i / (double)fract->max_itter;
h = fabs(cos(t)) * 360;
return (hsv2rgb(h, t, 1));
}
int color(t_fract *fract, t_z *z, int i)
{
if (fract->color == 0)
return (dark(fract, i));
else if (fract->color == 1)
return (lsd1(z, i));
else if (fract->color == 2)
return (lsd2(fract, z, i));
else if (fract->color == 3)
return (red(fract, i));
else if (fract->color == 4)
return (toxic1(fract, i));
else if (fract->color == 5)
return (toxic2(fract, i));
else if (fract->color == 6)
return (toxic3(fract, i));
return (0);
}