[OpenSCAD] function syntax

Bananapeel lunatica.xiaoyu at gmail.com
Fri Oct 28 14:26:16 EDT 2016

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.

More information about the Discuss mailing list