Yet another Bezier curve implementation

Yet another Bezier curve implementation

Description

There are many Bezier curve implementations out there, but somehow they all think differently from the way I do. This one thinks the way I do when I create a design: * I have a sequence of points, and I'd like to connect them with "something curvy". * So in the first iteration, I specify that sequence of points my curve is supposed to go through, like this: ``` polygon( bezier_curve_seq( [ [ 0, 0 ], [ 10, 0 ], [ 10, 10 ], ... )) ``` and I render it in OpenSCAD, so I can look at it and it indeed goes through the points I want it to go through. * Now that I have the basic line correct, I make it curvy, by adding the "handle points" (as a drawing program would show them): ``` polygon( bezier_curve_seq( [ [ 0, 0 ], [ 10, 0 ], [ 10, 10 ], ... [ [ [ 3, 3], [ 7, 3 ]], [], ... )) ``` simply by adding a second parameter to my existing invocation, without changing what I have already. * Between any two points of the sequence, I can either: * add no handle points, i.e. an empty vector which means I get a straight line between the points; * add a single point, which means I get a Bezier curve of degree 3, or * add two points, which means I get a Bezier curve of degree 4 between those points (only). The picture is of a flower whose petals are degree-4 curves. The master in part of my [JOSL](https://github.com/jernst/josl) OpenSCAD library, and maintained on Github [here](https://github.com/jernst/josl/tree/master/josl/bezier). Try the example!

Statistics

Likes

1

Downloads

0

Category

3D Printing