-
Notifications
You must be signed in to change notification settings - Fork 0
/
julia_functions.c
97 lines (87 loc) · 2.54 KB
/
julia_functions.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* julia_functions.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tdarchiv <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/11 14:05:11 by tdarchiv #+# #+# */
/* Updated: 2019/03/11 14:05:13 by tdarchiv ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractal_functions.h"
#include <math.h>
int get_julia_value(t_double2 z_in, int depth_max, t_double2 c)
{
t_double2 z;
int depth;
double z_y_temp;
depth = 1;
z = z_in;
while (((z.x * z.x) + (z.y * z.y) < 4) && (depth < depth_max))
{
z_y_temp = (2 * z.x * z.y) + c.y;
z.x = (z.x * z.x) - (z.y * z.y) + c.x;
z.y = z_y_temp;
depth++;
}
if (depth >= depth_max)
return (0);
return (depth);
}
int get_burning_julia_value(t_double2 z_in, int depth_max, t_double2 c)
{
t_double2 z;
int depth;
double z_y_temp;
depth = 1;
z = z_in;
while (((z.x * z.x) + (z.y * z.y) < 4) && (depth < depth_max))
{
z_y_temp = (2 * z.x * z.y);
z.x = (z.x * z.x) - (z.y * z.y) + c.x;
z.y = fabs(z_y_temp) + c.y;
z.x = fabs(z.x);
depth++;
}
if (depth >= depth_max)
return (0);
return (depth);
}
int get_julia3_value(t_double2 z_in, int depth_max, t_double2 c)
{
t_double2 z;
int depth;
double z_y_temp;
depth = 1;
z = z_in;
while (((z.x * z.x) + (z.y * z.y) < 4) && (depth < depth_max))
{
z_y_temp = -(z.y * z.y * z.y) + (3 * z.x * z.x * z.y) + c.y;
z.x = (z.x * z.x * z.x) - (3 * z.x * z.y * z.y) + c.x;
z.y = z_y_temp;
depth++;
}
if (depth >= depth_max)
return (0);
return (depth);
}
int get_burningjulia3_value(t_double2 z_in, int depth_max, t_double2 c)
{
t_double2 z;
int depth;
double z_y_temp;
depth = 1;
z = z_in;
while (((z.x * z.x) + (z.y * z.y) < 4) && (depth < depth_max))
{
z_y_temp = -(z.y * z.y * z.y) + (3 * z.x * z.x * z.y) + c.y;
z.x = (z.x * z.x * z.x) - (3 * z.x * z.y * z.y) + c.x;
z.y = fabs(z_y_temp) + c.y;
z.x = fabs(z.x);
depth++;
}
if (depth >= depth_max)
return (0);
return (depth);
}