Public Domain OpenScad Bezier Function

by WilliamAAdams, published

Public Domain OpenScad Bezier Function by WilliamAAdams May 11, 2011



Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

8004Views 1620Downloads


After playing around with fillets on this thing: http://www.thingiverse.com/thing:8416 I was determined to create a generalized Bezier function for usage in OpenScad.

This thing, or rather the OpenScad file, is public domain code for creating Bezier curves within OpenScad.

It is a foundational piece. It will only create Bezier curves defined by 4 control points. Those are typically the most useful in hand constructed graphics as found in OpenScad.

Hopefully this little piece of goodness will enable people to create very curvacious things in OpenScad. Extending the function to 3D can be easily done.

UPDATE: Added a couple more pictures that show different ways of using the beast. Perhaps the coolest is using a Bezier curve to change color over the surface of the object.


1) Create some appropriate control points
2) Choose a focal point
3) Call the BezQuadCurve() module
4) Rejoice!

If you're actually going to use the BezQuadCurve module, then you'll want to comment out the part that prints the control points.

The 'focalPoint' is the point from which all triangle fans will originate. You can choose this to be something appropriate for the kind of solid you're trying to create. The Bezier curve points themselves remain the same.

You can use the 'PointAlongBez4' function to calculate any point along the bezier curve defined by your control points, and the 'u' factor (between 0 and 1).

It's standard graphics stuff, but oh so useful.

All Apps

Upgrade this Thing with Thingiverse Apps

No results.

I made a library that can do bezier interpolation with between 1-8 control points (or more!). http://www.thingiverse.com/thing:86713http://www.thingiverse.com/thi...

Bezier Library for OpenScad
by ckirby

i dont know how to make a 'variation' but here is linke to my bezier function with three control points (Conic)


OpenSCAD Conic Bezier Curve
by donb

Nice Work!

Years back I had an assignment to generate guaranteed C2 curvature objects using bezier curves. Once you entered in 4 points for an initial bezier any additional point would generate another curve section... I feel like I should dig this old code up and port it to OpenSCAD now.

I think that would be a very good thing. Adding these primitives to the OpenScad design lexicon can only be good for making even more creative and sleek looking designs.

Good for me because even though I bought Alibre, it's going to be quite some time before I'm proficient at it. In the meantime, I know how to write code.

nice work, need a better collection of these things, maybe it should be added to one of the libs for openscad? there are at least a few.

I know of the various shape libraries that are available. Is there one that is specific to just core math/graphics functions? I think it could live in such a thing. I'd love to see some b/beta-spline goodies as well, and various other curve constructs.

In general, I'm trending towards being able to do my designs as parametrically (in a math sense) as possible, so perhaps there's room for a parametric construction library?

Also, I'm considering OpenScad as a backend representational language for transport, just like .stl is used today. Ideally
I'd like to feed OpenScad to my printer, and let it figure out how best to represent the thing in plastic, or jello, or whatever it so happens to be using.

Yah, isn't it funny. the funniest thing to me is that it's just a curve. It could just as easily describe height, motion, color, or whatever for OpenScad goodness, including animation...

Yeah, I just started playing with functions, and the possibilities are pretty endless. :-)