-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_cross_vec.c
28 lines (24 loc) · 1.12 KB
/
dot_cross_vec.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dot_cross_vec.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: shongou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 23:33:06 by shongou #+# #+# */
/* Updated: 2023/01/04 23:33:07 by shongou ### ########.fr */
/* */
/* ************************************************************************** */
#include "minirt.h"
double dot(t_vec a, t_vec b)
{
return (a.x * b.x + a.y * b.y + a.z * b.z);
}
t_vec cross(t_vec a, t_vec b)
{
t_vec vec;
vec.x = a.y * b.z - a.z * b.y;
vec.y = a.z * b.x - a.x * b.z;
vec.z = a.x * b.y - a.y * b.x;
return (vec);
}