Loading

OpenSCAD Conic Bezier Curve

by donb, published

OpenSCAD Conic Bezier Curve by donb May 30, 2011
0 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps

Contents

License

Public Domain
OpenSCAD Conic Bezier Curve by donb is licensed under the Public Domain license.

Use This Project

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

7404Views 2026Downloads

Summary

Conic Bézier Curve for OpenSCAD
also known as Quadratic Bezier Curve
also known as Bezier Curve with 3 control points
also known as 'Conic Arcs' or 'Parabolic Segments'
By Don B, 2011, released into the Public Domain

What's it for

Bezier curves allow you to pick a small number of 'control points', then let the computer fill in a pretty curve between them. In this thing, 3 control points are used.

Notes

This is for 3-point bezier curves; there is another popular type, the 4-point 'Cubic', that this code doesn't do.

This is inspired by William Adam's cubic bezier Thingiverse OpenSCAD code. His code now also handles Conics; I guess I will leave this thing here as a sort of 'super simple' 'for dummies' version.

The first sample image shows a simple 3 control-point curved polygon, and a rod around which it can be rotated. The result of this rotation is shown in the big smooth object.

The next sample image shows the code itself; the module is only about 10 lines long thanks to OpenSCAD's built-in vector math.

Please see also

http://www.thingiverse.com/thing:8443 by William A Adams (Cubic Beziers)
http://en.wikipedia.org/wiki/File:Bezier_2_big.gif by Phil Tregoning
http://en.wikipedia.org/wiki/B%C3%A9zier_curve by Wikipedia editors
http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html David Turner + Freetype team

Using the code

  1. download the .scad file, below
  2. copy/paste the BezConic module to your own code
  3. call it like this:

p0=[15,0];
p1=[1,14];
p2=[7,30];
linear_extrude() BezConic(p0,p1,p2,steps=20);

Fun Facts

Bézier are named after Pierre Bézier, who used the work of Paul de Casteljau to make curves on car bodies. Casteljau worked at Citroen and Bezier worked at Renault.

They are named 'conic' because 3-point Bezier's are basically parabolas. A parabola is basically the intersection of a cone with a plane (i.e. a conic section). Please see wikipedia for more info.

Conic Arc Bézier Curves (3 control points) are used by TrueType fonts.

Instructions

An example .stl file is included just for giggles.

All Apps

3D Print your file with 3D Hubs, the world’s largest online marketplace for 3D printing services.

App Info Launch App

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

Here's a modified version of your module that will create a solid shape with a Bezier curve profile:

module bezier_solid( p0, p1, p2, steps = 5 ) {
    stepsize1 = (p1-p0)/steps;
    stepsize2 = (p2-p1)/steps;

    rotate_extrude() {
        for (i=[0:steps-1]) {
            point1 = p0+stepsize1*i;
            point2 = p1+stepsize2*i;
            point3 = p0+stepsize1*(i+1);
            point4 = p1+stepsize2*(i+1);
            bpoint1 = point1+(point2-point1)*(i/steps);
            bpoint2 = point3+(point4-point3)*((i+1)/steps);
            polygon(
                points=[
                   [0, bpoint1[1]],
                   bpoint1,
                   bpoint2,
                   [0, bpoint2[1]]
                ]
            );
        }
    }
}

Exactlly right!

I had actually added the 3 point Beziers to my latest mesh/surface library, but didn't advertise. Rotation around any axis would be a very good thing. This combined with some surface normal goodness and you've got the makings of a killer new feature which I'm sure will be much used. Think of ho
w easy it is to create a vase of almost any shape!

lol redundancy. which one is your latest library? there are so many....

Top