Add math library

This commit is contained in:
Quinn
2022-01-09 15:10:14 -08:00
parent b0cd663d6d
commit bfd9286a51
2 changed files with 10 additions and 28 deletions
+5
View File
@@ -0,0 +1,5 @@
function normalize(vec) = vec / norm(vec);
function lerp(a,b,t) = a + (b - a) * t;
function scale_xy(shape, xy, allow_zero = false) = let(s = allow_zero ? xy : sign(xy == 0 ? 1 : xy) * max(abs(xy), 0.0001)) [ for (i = shape) [i.x * s, i.y * s]];