[OpenSCAD] Bezier functions in OpenSCAD

Peter Falke stempeldergeschichte at googlemail.com
Wed Apr 1 10:13:40 EDT 2015


These functions only give a point vector.
The real work is to stitch a solid from this. (And if you can stitch the
solid, then you probably can write your own
Bezier function, too.)
Is there a a general way to generate a Bezier-solid ?
Maybe a pie-cylinder with the outside curve beeing a Bezier curve.
If yes, I would support it, as designs nowadays go more and more to organic
forms.

2015-04-01 12:49 GMT+02:00 David Eccles (gringer) <
bioinformatics at gringene.org>:

> I found a bezier curve library that looks somewhat reasonable, in that it
> doesn't have any hard-coded values or iteration limitations:
>
> http://www.thingiverse.com/download:98926
>
> Compare with this library, which suffers from "I need to write a different
> function for different arguments" syndrome:
>
> https://github.com/chadkirby/BezierScad/blob/master/BezierScad.scad
>
> 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) = [
>         BEZ03(u)*p0[0]+BEZ13(u)*p1[0]+BEZ23(u)*p2[0]+BEZ33(u)*p3[0],
>         BEZ03(u)*p0[1]+BEZ13(u)*p1[1]+BEZ23(u)*p2[1]+BEZ33(u)*p3[1]];
>
> function PointOnBezCubic3D(p0, p1, p2, p3, u) = [
>         BEZ03(u)*p0[0]+BEZ13(u)*p1[0]+BEZ23(u)*p2[0]+BEZ33(u)*p3[0],
>         BEZ03(u)*p0[1]+BEZ13(u)*p1[1]+BEZ23(u)*p2[1]+BEZ33(u)*p3[1],
>         BEZ03(u)*p0[2]+BEZ13(u)*p1[2]+BEZ23(u)*p2[2]+BEZ33(u)*p3[2]];
>
> 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.
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>



-- 
stempeldergeschichte at googlemail.com <karsten at rohrbach.de>

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150401/49561797/attachment-0002.html>


More information about the Discuss mailing list