tjrs en amelioration du dessin des lignes

This commit is contained in:
hugogogo
2021-07-22 15:01:04 +02:00
parent 4fcea738ce
commit 25d3c943d8
3 changed files with 1 additions and 21 deletions

Binary file not shown.

BIN
fdf

Binary file not shown.

View File

@@ -19,10 +19,6 @@ void draw_lines(t_fdf *fdf, int *start, int *end)
int dz;
int i;
int j;
int slope_big;
int slope_small;
int pixel;
int z;
if (end)
{
@@ -31,7 +27,7 @@ void draw_lines(t_fdf *fdf, int *start, int *end)
//dz = end[2] - start[2];
i = 0;
j = 0;
while (i < dx && j < dy)
while (i <= dx && j <= dy)
{
draw_color_pixel(fdf, start[0] + i, start[1] + j, start[2]);
if (j < i * dy / dx)
@@ -39,26 +35,10 @@ void draw_lines(t_fdf *fdf, int *start, int *end)
else
i++;
}
/*
slope_big = ft_greater(ft_absolute(dx), ft_absolute(dy));
slope_small = ft_smaller(ft_absolute(dx), ft_absolute(dy));
i = 0;
while (++i <= slope_big)
{
pixel = slope_small / slope_big * i * ft_sign(dx);
z = start[3] + (dz / slope_big * i);
draw_color_pixel(fdf, start[0] + i, start[1] + pixel, z);
}
*/
}
(void)dx;
(void)dy;
(void)dz;
(void)slope_big;
(void)slope_small;
(void)i;
(void)pixel;
(void)z;
}
// point[0], point[1], point[2] -> new x, new y, new z