#include "types.h" #include "math.h" struct Vec2 vec2_normalize(struct Vec2 v) { float abs = sqrt(v.x * v.x + v.y * v.y); return (struct Vec2){v.x / abs, v.y / abs}; } struct Vec2 vec2_rotate(struct Vec2 v, float alpha) { return (struct Vec2){v.x * cosf(alpha) - v.y * sinf(alpha), v.x * sinf(alpha) + v.y * cosf(alpha)}; }