vec2f.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* vec2f.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: ll-hotel <ll-hotel@student.42.fr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2024/08/01 13:30:14 by ll-hotel #+# #+# */ 9 /* Updated: 2024/08/24 18:13:09 by ll-hotel ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "vec2f.h" 14 15 t_vec2f vec2f(float x, float y) 16 { 17 return ((t_vec2f){x, y}); 18 } 19 20 t_vec2f vec2f_add(t_vec2f v1, t_vec2f v2) 21 { 22 return ((t_vec2f){v1.x + v2.x, v1.y + v2.y}); 23 } 24 25 t_vec2f vec2f_sub(t_vec2f v1, t_vec2f v2) 26 { 27 return ((t_vec2f){v1.x - v2.x, v1.y - v2.y}); 28 } 29 30 t_vec2f vec2f_scal(t_vec2f v, float scalar) 31 { 32 v.x *= scalar; 33 v.y *= scalar; 34 return (v); 35 }