Skip to content

Commit

Permalink
Fractol final
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad abir Abbas committed Dec 10, 2022
1 parent 2859b05 commit ae564c6
Show file tree
Hide file tree
Showing 63 changed files with 47 additions and 14 deletions.
Binary file added fractol
Binary file not shown.
Binary file added libs/libft/ft_atoi.o
Binary file not shown.
Binary file added libs/libft/ft_bzero.o
Binary file not shown.
Binary file added libs/libft/ft_calloc.o
Binary file not shown.
Binary file added libs/libft/ft_isalnum.o
Binary file not shown.
Binary file added libs/libft/ft_isalpha.o
Binary file not shown.
Binary file added libs/libft/ft_isascii.o
Binary file not shown.
Binary file added libs/libft/ft_isdigit.o
Binary file not shown.
Binary file added libs/libft/ft_isprint.o
Binary file not shown.
Binary file added libs/libft/ft_itoa.o
Binary file not shown.
Binary file added libs/libft/ft_lstadd_back.o
Binary file not shown.
Binary file added libs/libft/ft_lstadd_front.o
Binary file not shown.
Binary file added libs/libft/ft_lstclear.o
Binary file not shown.
Binary file added libs/libft/ft_lstdelone.o
Binary file not shown.
Binary file added libs/libft/ft_lstiter.o
Binary file not shown.
Binary file added libs/libft/ft_lstlast.o
Binary file not shown.
Binary file added libs/libft/ft_lstmap.o
Binary file not shown.
Binary file added libs/libft/ft_lstnew.o
Binary file not shown.
Binary file added libs/libft/ft_lstsize.o
Binary file not shown.
Binary file added libs/libft/ft_memchr.o
Binary file not shown.
Binary file added libs/libft/ft_memcmp.o
Binary file not shown.
Binary file added libs/libft/ft_memcpy.o
Binary file not shown.
Binary file added libs/libft/ft_memmove.o
Binary file not shown.
Binary file added libs/libft/ft_memset.o
Binary file not shown.
Binary file added libs/libft/ft_putchar_fd.o
Binary file not shown.
Binary file added libs/libft/ft_putendl_fd.o
Binary file not shown.
Binary file added libs/libft/ft_putnbr_fd.o
Binary file not shown.
Binary file added libs/libft/ft_putstr_fd.o
Binary file not shown.
Binary file added libs/libft/ft_split.o
Binary file not shown.
Binary file added libs/libft/ft_strchr.o
Binary file not shown.
Binary file added libs/libft/ft_strdup.o
Binary file not shown.
Binary file added libs/libft/ft_striteri.o
Binary file not shown.
Binary file added libs/libft/ft_strjoin.o
Binary file not shown.
Binary file added libs/libft/ft_strlcat.o
Binary file not shown.
Binary file added libs/libft/ft_strlcpy.o
Binary file not shown.
Binary file added libs/libft/ft_strlen.o
Binary file not shown.
Binary file added libs/libft/ft_strmapi.o
Binary file not shown.
Binary file added libs/libft/ft_strncmp.o
Binary file not shown.
Binary file added libs/libft/ft_strnstr.o
Binary file not shown.
Binary file added libs/libft/ft_strrchr.o
Binary file not shown.
Binary file added libs/libft/ft_strtrim.o
Binary file not shown.
Binary file added libs/libft/ft_substr.o
Binary file not shown.
Binary file added libs/libft/ft_tolower.o
Binary file not shown.
Binary file added libs/libft/ft_toupper.o
Binary file not shown.
Binary file modified libs/libft/libft.a
Binary file not shown.
Binary file added libs/minilibx-linux/libmlx.a
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_init_loop.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_int_str_to_wordtab.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_mouse.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_new_image.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_new_window.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_png.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_shaders.o
Binary file not shown.
Binary file added libs/minilibx-linux/mlx_xpm.o
Binary file not shown.
31 changes: 30 additions & 1 deletion src/colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mabbas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/08 14:30:35 by mabbas #+# #+# */
/* Updated: 2022/12/10 00:34:28 by mabbas ### ########.fr */
/* Updated: 2022/12/10 23:39:41 by mabbas ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -63,3 +63,32 @@ int color_init(t_mlx *mlx)
}
return (trgb_gen(color[0], color[1], color[2], color[3]));
}

/** Experimental Color conversions **/
// int color_init(t_mlx *mlx)
// {
// double t;
// int color[4];

// t = (double)mlx->iter / (double)mlx->iter_max;
// color[0] = 0;
// if (mlx->shift == 1)
// {
// color[1] = (rand()) * 255 * t;
// color[2] = (rand()) * 1 * t;
// color[3] = (rand()) * 125 * (1 - t);
// }
// if (mlx->shift == 2)
// {
// color[2] = (int)(9 * (1 - t) * pow(t, 3) * 235);
// color[1] = (int)(13 * pow((1 - t), 2) * pow(t, 2) * 255);
// color[3] = (int)(7 * pow((1 - t), 3) * t * 225);
// }
// if (mlx->shift == 3)
// {
// color[3] = (int)(9 * (1 - t) * pow(t, 3) * 255);
// color[2] = (int)(15 * pow((1 - t), 2) * pow(t, 2) * 121);
// color[1] = (int)(8.5 * pow((1 - t), 3) * t * 225);
// }
// return (trgb_gen(color[0], color[1], color[2], color[3]));
// }
Binary file added src/colors.o
Binary file not shown.
Binary file added src/equations.o
Binary file not shown.
Binary file added src/initialization.o
Binary file not shown.
Binary file added src/key_oper.o
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mabbas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/08 20:43:36 by mabbas #+# #+# */
/* Updated: 2022/12/10 14:50:21 by mabbas ### ########.fr */
/* Updated: 2022/12/10 22:20:26 by mabbas ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
Binary file added src/main.o
Binary file not shown.
28 changes: 16 additions & 12 deletions src/mouse_oper.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mabbas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/08 19:23:34 by mabbas #+# #+# */
/* Updated: 2022/12/10 00:54:55 by mabbas ### ########.fr */
/* Updated: 2022/12/10 22:50:38 by mabbas ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -18,37 +18,41 @@
* An extra check is there for the coeff value range.
**/

// double lerp(double start, double end, double inter_coeff)
// {
// if (inter_coeff <= 0.0)
// return (start);
// if (inter_coeff >= 1.0)
// return (end);
// return ((1 - inter_coeff) * start + inter_coeff * end);
// }

double lerp(double start, double end, double inter_coeff)
{
if (inter_coeff <= 0.0)
return (start);
if (inter_coeff >= 1.0)
return (end);
return ((1 - inter_coeff) * start + inter_coeff * end);
return (start + ((end - start) * inter_coeff));
}

int ctrl_mouse(int key, int x, int y, t_mlx *mlx)
{
t_oper mouse;
double zoom;

zoom = 0.0;
if (key == 1)
mlx->press = 1;
mouse.r = (mlx->min.r + x * ((mlx->max.r - mlx->min.r)
/ (WIDTH)));
mouse.i = (mlx->max.i - y * ((mlx->max.i - mlx->min.i)
/ (HEIGHT)));
if (key == 5)
zoom = 1.10;
zoom = 1.20;
else if (key == 4)
zoom = 0.75;
zoom = 0.80;
else
zoom = 1;
zoom = 1.0;
mlx->min.r = lerp(mouse.r, mlx->min.r, zoom);
mlx->min.i = lerp(mouse.i, mlx->min.i, zoom);
mlx->max.r = lerp(mouse.r, mlx->max.r, zoom);
mlx->min.i = lerp(mouse.i, mlx->min.r, zoom);
mlx->max.i = lerp(mouse.i, mlx->max.i, zoom);
render_fractal(mlx);
return (0);
}
Expand All @@ -61,7 +65,7 @@ int julia_key_press(int key, int x, int y, t_mlx *mlx)
(void) x;
(void) y;
if (key == 1)
mlx->press = KEY_A;
mlx->press = 0;
return (0);
}

Expand Down
Binary file added src/mouse_oper.o
Binary file not shown.

0 comments on commit ae564c6

Please sign in to comment.