implementation de line a faire
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
quick description
|
||||
|
||||
- [test](./fdf_subject.pdf)
|
||||
- [subject here](./fdf_subject.pdf)
|
||||
|
||||
|
||||
### ressources
|
||||
|
||||
42
srcs/fdf.c
42
srcs/fdf.c
@@ -12,27 +12,6 @@ void rotation_state(t_fdf *fdf);
|
||||
int **parse_map(t_fdf *fdf);
|
||||
int *new_coordinates(t_fdf *fdf, int i, int j);
|
||||
|
||||
// return an int[3] : int[0] = x, int[1] = y, int[2] = z
|
||||
int *new_coordinates(t_fdf *fdf, int i, int j)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int *point;
|
||||
|
||||
point = ft_calloc(3, sizeof(int));
|
||||
x = i * fdf->offset - (fdf->map_size_x / 2);
|
||||
y = j * fdf->offset - (fdf->map_size_y / 2);
|
||||
z = fdf->map[j][i] * fdf->altitude;
|
||||
point[0] = x * cos(fdf->rad_x) + y * sin(fdf->rad_x);
|
||||
point[1] = y * cos(fdf->rad_x) - x * sin(fdf->rad_x);
|
||||
point[1] = point[1] * cos(fdf->rad_y) - -z * sin(fdf->rad_y);
|
||||
point[0] += fdf->margin + fdf->mov_x + (fdf->map_size_x / 2);
|
||||
point[1] += fdf->margin + fdf->mov_y + (fdf->map_size_y / 2);
|
||||
point[2] = z;
|
||||
return (point);
|
||||
}
|
||||
|
||||
// point[0], point[1], point[2] -> new x, new y, new z
|
||||
void draw_lines(t_fdf *fdf, int i, int j)
|
||||
{
|
||||
@@ -84,6 +63,27 @@ int main(int ac, char **av)
|
||||
return (0);
|
||||
}
|
||||
|
||||
// return an int[3] : int[0] = x, int[1] = y, int[2] = z
|
||||
int *new_coordinates(t_fdf *fdf, int i, int j)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int *point;
|
||||
|
||||
point = ft_calloc(3, sizeof(int));
|
||||
x = i * fdf->offset - (fdf->map_size_x / 2);
|
||||
y = j * fdf->offset - (fdf->map_size_y / 2);
|
||||
z = fdf->map[j][i] * fdf->altitude;
|
||||
point[0] = x * cos(fdf->rad_x) + y * sin(fdf->rad_x);
|
||||
point[1] = y * cos(fdf->rad_x) - x * sin(fdf->rad_x);
|
||||
point[1] = point[1] * cos(fdf->rad_y) - -z * sin(fdf->rad_y);
|
||||
point[0] += fdf->margin + fdf->mov_x + (fdf->map_size_x / 2);
|
||||
point[1] += fdf->margin + fdf->mov_y + (fdf->map_size_y / 2);
|
||||
point[2] = z;
|
||||
return (point);
|
||||
}
|
||||
|
||||
int keypress(int keycode, t_fdf *fdf)
|
||||
{
|
||||
if (keycode == ESCAPE)
|
||||
|
||||
Reference in New Issue
Block a user