From 86f9c2ead9daa1fd81ec3181e16698f3d354ce25 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Mon, 11 Feb 2019 18:47:07 -0800 Subject: [PATCH] Added vmul() --- math.scad | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/math.scad b/math.scad index f40fb62..dc86aea 100644 --- a/math.scad +++ b/math.scad @@ -116,6 +116,10 @@ function path3d(points) = [for (point = points) point3d(point)]; function distance(p1, p2) = let(d = point3d(p2) - point3d(p1)) hypot3(d[0], d[1], d[2]); +// Multiplies corresponding elements in two vectors. +function vmul(v1, v2) = [for (i = [0:len(v1)-1]) v1[i]*v2[i]]; + + // Create an identity matrix, for a given number of axes. function ident(n) = [for (i = [0:n-1]) [for (j = [0:n-1]) (i==j)?1:0]];