discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] function syntax

B
Bananapeel
Fri, Oct 28, 2016 6:26 PM

let() does "Sequential assignment of variables inside an expression."

// args should be in clockwise order looking from the outside
function normal(p1, p2, p3) =
let(u = p2 - p1,
v = p3 - p1,
x = u[1]*v[2] - u[2]*v[1],
y = u[2]*v[0] - u[0]*v[2],
z = u[0]*v[1] - u[1]*v[0])
[x, y, z];

--
View this message in context: http://forum.openscad.org/function-syntax-tp5915p18821.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

let() does "Sequential assignment of variables inside an expression." // args should be in clockwise order looking from the outside function normal(p1, p2, p3) = let(u = p2 - p1, v = p3 - p1, x = u[1]*v[2] - u[2]*v[1], y = u[2]*v[0] - u[0]*v[2], z = u[0]*v[1] - u[1]*v[0]) [x, y, z]; -- View this message in context: http://forum.openscad.org/function-syntax-tp5915p18821.html Sent from the OpenSCAD mailing list archive at Nabble.com.