Skip to content

Commit

Permalink
fixing segfault when dividing by zero in sinzc
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxenceee committed Oct 9, 2023
1 parent 4052032 commit 5587527
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ Use the `-c` parameter to display the various commands available.

![alt text](https://github.com/Maxenceee/fract-ol-42/blob/main/images/img5.png "Mandelbrot Variant Z^4")

![alt text](https://github.com/Maxenceee/fract-ol-42/blob/main/images/img13.png "Mandelbrot Variant Z^3")

![alt text](https://github.com/Maxenceee/fract-ol-42/blob/main/images/img14.png "Mandelbrot Variant Z^3")

<!-- You can also generate a specific fractal among the following, the Julia set, the Mandelbrot set, the Burningship set or the Apollonian gasket fractal. -->
2 changes: 1 addition & 1 deletion bonus/fractal_julia_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mgama <mgama@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/22 23:28:46 by mgama #+# #+# */
/* Updated: 2023/05/02 01:35:48 by mgama ### ########.fr */
/* Updated: 2023/10/10 01:35:22 by mgama ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
4 changes: 3 additions & 1 deletion bonus/fractal_sinzc_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mgama <mgama@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/02 01:37:10 by mgama #+# #+# */
/* Updated: 2023/05/20 22:40:46 by mgama ### ########.fr */
/* Updated: 2023/10/10 01:36:09 by mgama ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -70,6 +70,8 @@ t_pixel calcule_sinzc_series(t_complex_number point,

mul = mlx->fractal_list[mlx->current_fractal_type].formula_exp;
num = create_complex_number(point.x, point.y);
if (num.x == 0.f && num.y == 0.f)
num = create_complex_number(1, 1);
max_iter = get_max_iter_from_scale();
i = 0;
while (modulus_complex_2(num) < (1 << 8) && i < max_iter)
Expand Down
4 changes: 3 additions & 1 deletion bonus/fractol_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mgama <mgama@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/22 23:26:13 by mgama #+# #+# */
/* Updated: 2023/10/10 00:36:01 by mgama ### ########.fr */
/* Updated: 2023/10/10 01:37:23 by mgama ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -99,4 +99,6 @@ julia7 fav
Mandelbrot vr2
Z^3 +0.597 -0.000i
Z^3 +0.540 +0.092i
Z^3 +0.597 +0.000i
Z^3 +0.529 +0.001i
*/
2 changes: 1 addition & 1 deletion bonus/fractol_init_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mgama <mgama@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/16 13:44:29 by mgama #+# #+# */
/* Updated: 2023/07/12 18:58:00 by mgama ### ########.fr */
/* Updated: 2023/10/10 01:33:15 by mgama ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
Binary file added images/img13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5587527

Please sign in to comment.