[OpenSCAD] Bezier functions in OpenSCAD

David Eccles (gringer) bioinformatics at gringene.org
Wed Apr 1 06:49:01 EDT 2015

I found a bezier curve library that looks somewhat reasonable, in that it
doesn't have any hard-coded values or iteration limitations:


Compare with this library, which suffers from "I need to write a different
function for different arguments" syndrome:


Is there any chance of adding at least the bezier functions to OpenSCAD:

	Bernstein Basis Functions

	For Bezier curves, these functions give the weights per control point.

function BEZ03(u) = pow((1-u), 3);
function BEZ13(u) = 3*u*(pow((1-u),2));
function BEZ23(u) = 3*(pow(u,2))*(1-u);
function BEZ33(u) = pow(u,3);

// Calculate a singe point along a cubic bezier curve
// Given a set of 4 control points, and a parameter 0 <= 'u' <= 1
// These functions will return the exact point on the curve
function PointOnBezCubic2D(p0, p1, p2, p3, u) = [

function PointOnBezCubic3D(p0, p1, p2, p3, u) = [

The modules need a bit of work, because they're generating duplicate
points at the focal location, instead of combining the triangles into a
single polygon.

More information about the Discuss mailing list