-
Notifications
You must be signed in to change notification settings - Fork 0
/
julia.c
42 lines (38 loc) · 1.6 KB
/
julia.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* julia.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zrabhi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/09 10:36:57 by zrabhi #+# #+# */
/* Updated: 2022/04/10 02:05:08 by zrabhi ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
void julia_data(t_fractol *data)
{
data->julia_var_re = 0.285;
data->julia_var_im = 0.01;
}
static void iteration_calc(t_fractol *data)
{
data->iteration = 0;
while ((data->iteration < data->max_iteration))
{
data->oldre = data->newre;
data->oldim = data->newim;
data->newre = data->oldre * data->oldre - data->oldim * data->oldim \
+ data->julia_var_re;
data->newim = 2 * data->oldre * data->oldim + data->julia_var_im;
data->iteration++;
if (((data->newre * data->newre) + (data->newim * data->newim) > 4))
break ;
}
}
void julia(t_fractol *data)
{
data->newre = (data->x * data->x_scale) - data->x_center;
data->newim = (data->y * data->y_scale) - data->y_center;
iteration_calc(data);
}