tmp push merge resolution not finished

This commit is contained in:
Baptiste GOULARD 2024-11-28 16:02:06 +01:00
parent 2568aa69a6
commit 00dc0e9e67
16 changed files with 454 additions and 59 deletions

39
raycast/utils_math.c Normal file
View file

@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_math.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/28 14:09:12 by bgoulard #+# #+# */
/* Updated: 2024/11/28 14:54:32 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d_struct.h"
#include <math.h>
void my_mlx_pixel_put(t_info *data, int x, int y, int color)
{
uint *dst;
x *= data->camera.bpp / 8;
dst = (uint *)(data->camera.img_addr + (y * data->camera.line_len + x));
*dst = color;
}
double deg2rad(int deg)
{
return (deg * M_PI / 180);
}
void rotate_plane(t_dpoint *plane, double angle)
{
double old_plane_x;
double old_plane_y;
old_plane_x = (*plane).x;
old_plane_y = (*plane).y;
plane->x = plane->x * cos(angle) - plane->y * sin(angle);
plane->y = old_plane_x * sin(angle) + plane->y * cos(angle);
}