-
Notifications
You must be signed in to change notification settings - Fork 0
/
quadrillage.c
44 lines (41 loc) · 936 Bytes
/
quadrillage.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
/*
** quadrillage.c for quadrillage in /home/nicolas/Modules/gfx_raytracer1
**
** Made by menett_a
** Login <[email protected]>
**
** Started on Mon Mar 7 13:22:48 2016 menett_a
** Last update Thu Mar 10 02:27:02 2016 menett_a
*/
#include <lapin.h>
#include <math.h>
#include "struct.h"
#include "proto.h"
void quadrillage(t_collision *collision)
{
double x;
double y;
double z;
if ((x = (collision->pos_x / 1.75)) < 0)
x = -x + 1;
if ((y = (collision->pos_y / 1.75)) < 0)
y = -y + 1;
if ((z = (collision->pos_z / 1.75)) < 0)
z = -z + 1;
if ((int)z % 2 == 0)
{
if (((int)x % 2 == 0 && (int)y % 2 == 0)
|| ((int)x % 2 == 1 && (int)y % 2 == 1))
collision->color = 0;
else
collision->color = 1;
}
else
{
if (((int)x % 2 == 0 && (int)y % 2 == 0)
|| ((int)x % 2 == 1 && (int)y % 2 == 1))
collision->color = 1;
else
collision->color = 0;
}
}