More math

This commit is contained in:
2025-02-13 22:13:16 +01:00
parent ee7f5e9595
commit 29f5e84312
2 changed files with 41 additions and 1 deletions

View File

@@ -38,4 +38,8 @@ export function scale(a: Vec3, s: number) : Vec3 {
a[1] * s,
a[2] * s,
];
}
}
export function normalize(a: Vec3) : Vec3 {
return scale(a, 1/norm(a));
}