8 lines
174 B
C
8 lines
174 B
C
#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};
|
|
}
|