-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils_vec3.c
More file actions
29 lines (25 loc) · 1.16 KB
/
Copy pathutils_vec3.c
File metadata and controls
29 lines (25 loc) · 1.16 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_vec3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khlavaty <khlavaty@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/09 12:32:17 by fvonsovs #+# #+# */
/* Updated: 2024/09/12 20:52:28 by khlavaty ### ########.fr */
/* */
/* ************************************************************************** */
#include "minirt.h"
t_float_3 vec_negate(t_float_3 vec)
{
t_float_3 result;
result.x = -vec.x;
result.y = -vec.y;
result.z = -vec.z;
return (result);
}
// calculates the magnitude of a vector
float vec_length(t_float_3 vec)
{
return (sqrtf(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z));
}