-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlight.c
More file actions
40 lines (34 loc) · 1.4 KB
/
Copy pathlight.c
File metadata and controls
40 lines (34 loc) · 1.4 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
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* light.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kaan <kaan@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/08 14:16:34 by kaan #+# #+# */
/* Updated: 2024/08/25 18:16:40 by kaan ### ########.fr */
/* */
/* ************************************************************************** */
#include "minirt.h"
void light_init(t_light *light)
{
t_vec position;
double intensity;
position = vec(-2, 5, 0);
intensity = 1.0;
light->position = vec(position.x, position.y, position.z);
light->intensity = intensity;
light->color = vec(0.0 + intensity, 0.0 + intensity, 0.0 + intensity);
}
double cos_angle_between(t_vec a, t_vec b)
{
float len;
len = length(a) * length(b);
if (len == 0)
return (1);
return (dot_vec(a, b) / len);
}
double angle_between(t_vec a, t_vec b)
{
return (acos(cos_angle_between(a, b)));
}