-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_point.c
48 lines (44 loc) · 1.66 KB
/
check_point.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_point.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoroka <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/12 14:17:04 by asoroka #+# #+# */
/* Updated: 2017/04/12 20:15:41 by asoroka ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
static void fill_line(t_line *line)
{
(*line).x0 = (*line).p0->x_screen;
(*line).y0 = (*line).p0->y_screen;
(*line).x1 = (*line).p1->x_screen;
(*line).y1 = (*line).p1->y_screen;
}
void check_point(t_point *point, t_fdf *fdf)
{
t_line line;
line.p0 = point;
line.x0 = point->x_screen;
line.y0 = point->y_screen;
if (point->next)
{
line.p0 = (Z < point->next->z) ? point : point->next;
line.p1 = (Z < point->next->z) ? point->next : point;
fill_line(&line);
put_line(fdf, line);
}
if (point->down)
{
line.p0 = (Z < point->down->z) ? point : point->down;
line.p1 = (Z < point->down->z) ? point->down : point;
fill_line(&line);
put_line(fdf, line);
}
else if (!point->down && !point->next && Y == 0 && X == 0)
{
put_pixel(500, 500, fdf, 0xFFFFFF);
}
}