-
Notifications
You must be signed in to change notification settings - Fork 2
/
vector.h
50 lines (44 loc) · 1.92 KB
/
vector.h
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
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* vector.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: upopee <upopee@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/13 19:31:25 by upopee #+# #+# */
/* Updated: 2018/05/13 19:39:06 by upopee ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef VECTOR_H
# define VECTOR_H
typedef struct s_vector2
{
float x;
float y;
} t_vector2;
t_vector2 ft_to_vec2(float x, float y);
t_vector2 ft_vec2_add(t_vector2 v1, t_vector2 v2);
t_vector2 ft_vec2_sub(t_vector2 v1, t_vector2 v2);
t_vector2 ft_vec2_scale(t_vector2 v, float n);
t_vector2 ft_vec2_opp(t_vector2 v);
float ft_vec2_dotprod(t_vector2 v1, t_vector2 v2);
float ft_vec2_magn(t_vector2 v);
t_vector2 ft_vec2_normalize(t_vector2 v);
int ft_vec2_equal(t_vector2 v1, t_vector2 v2);
typedef struct s_vector3
{
float x;
float y;
float z;
} t_vector3;
t_vector3 ft_to_vec3(float x, float y, float z);
t_vector3 ft_vec3_add(t_vector3 v1, t_vector3 v2);
t_vector3 ft_vec3_sub(t_vector3 v1, t_vector3 v2);
t_vector3 ft_vec3_scale(t_vector3 v, float n);
t_vector3 ft_vec3_opp(t_vector3 v);
t_vector3 ft_vec3_crossprod(t_vector3 v1, t_vector3 v2);
float ft_vec3_dotprod(t_vector3 v1, t_vector3 v2);
float ft_vec3_magn(t_vector3 v);
t_vector3 ft_vec3_normalize(t_vector3 v);
int ft_vec3_equal(t_vector3 v1, t_vector3 v2);
#endif