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.
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
- download the .scad file, below
- copy/paste the BezConic module to your own code
- call it like this:
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.