-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
20 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,18 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/15 18:46:11 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:30:16 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:37:17 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#ifndef FRACTOL_H | ||
# define FRACTOL_H | ||
|
||
# include "libft/libft.h" | ||
# include "minilibx/mlx.h" | ||
# include <math.h> | ||
|
||
# define SIZE 700 | ||
# define MAX_ITERATIONS 142 | ||
|
||
// KEYCODES | ||
# define ESC 53 | ||
|
@@ -56,10 +59,6 @@ typedef struct s_fractal | |
int max_iterations; | ||
} t_fractal; | ||
|
||
# include "libft/libft.h" | ||
# include "minilibx/mlx.h" | ||
# include <math.h> | ||
|
||
// utils.c | ||
void put_color_to_pixel(t_fractal *fractal, int x, int y, int colour); | ||
int exit_fractal(t_fractal *fractal); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/16 13:55:52 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:33:00 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:35:31 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -46,5 +46,5 @@ void calculate_burning_ship(t_fractal *fractal) | |
put_color_to_pixel(fractal, fractal->x, fractal->y, 0x000000); | ||
else | ||
put_color_to_pixel(fractal, fractal->x, fractal->y, (fractal->color | ||
* i)); | ||
* i)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/16 13:55:52 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:31:13 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:36:42 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -47,5 +47,5 @@ void calculate_julia(t_fractal *fractal, double cx, double cy) | |
put_color_to_pixel(fractal, fractal->x, fractal->y, 0x000000); | ||
else | ||
put_color_to_pixel(fractal, fractal->x, fractal->y, (fractal->color * (i | ||
% 255))); | ||
% 255))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/13 22:55:04 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:29:37 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:36:32 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -35,16 +35,16 @@ int draw_fractal(t_fractal *fractal, char *query, double cx, double cy) | |
calculate_burning_ship(fractal); | ||
else | ||
{ | ||
ft_putendl_fd("Available fractals: mandelbrot, julia, burningship", 1); | ||
ft_putendl_fd("Available fractals: mandel, julia, ship", 1); | ||
exit_fractal(fractal); | ||
} | ||
fractal->y++; | ||
} | ||
fractal->x++; | ||
fractal->y = 0; | ||
} | ||
mlx_put_image_to_window(fractal->mlx, fractal->window, | ||
fractal->image, 0, 0); | ||
mlx_put_image_to_window(fractal->mlx, fractal->window, fractal->image, 0, | ||
0); | ||
return (0); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/16 13:27:23 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:31:26 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:36:46 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -63,5 +63,5 @@ void calculate_mandelbrot(t_fractal *fractal) | |
put_color_to_pixel(fractal, fractal->x, fractal->y, 0x000000); | ||
else | ||
put_color_to_pixel(fractal, fractal->x, fractal->y, (fractal->color | ||
* i)); | ||
* i)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/16 18:11:08 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 18:04:16 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:35:46 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -44,6 +44,7 @@ void zoom(t_fractal *fractal, int x, int y, int zoom) | |
else | ||
return ; | ||
} | ||
|
||
/** | ||
* @brief Sets the constants of Julia to random values. | ||
* | ||
|
@@ -100,6 +101,7 @@ int key_hook(int key_code, t_fractal *fractal) | |
draw_fractal(fractal, fractal->name, cx, cy); | ||
return (0); | ||
} | ||
|
||
/** | ||
* @brief The handler for mouse events. | ||
* SCROLL_UP: zoom in. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: lgaudin <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/06/16 13:27:37 by lgaudin #+# #+# */ | ||
/* Updated: 2023/06/17 17:58:49 by lgaudin ### ########.fr */ | ||
/* Updated: 2023/06/17 18:35:55 by lgaudin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -42,6 +42,7 @@ int exit_fractal(t_fractal *fractal) | |
exit(1); | ||
return (0); | ||
} | ||
|
||
/** | ||
* @brief Generates a random double between -1.5 and 1.5. | ||
* | ||
|