A
adrianv
Fri, Jan 29, 2021 3:37 AM
On the matter of beziers I found that the fastest way to calculate them in
OpenSCAD is using the matrix representation, which isn't commonly discussed.
If you can do something with matrices it will almost always be the fastest
method in OpenSCAD. I changed the BOSL2 general order N bezier from the
recursive de Casteljau method (that you have below) to the matrix method and
got a 10-20 times speed improvement, which can make a difference when doing
bezier surfaces with lots of points. The continuous curvature rounding
stuff I did required 4th order beziers.
acwest wrote
On the subject of bezier's, I implemented them in my own libraries with:
function linearBezier(p0, p1, t) = p0 + (p1 - p0) * t;
function quadraticBezier(p0, p1, p2, t) = linearBezier(linearBezier(p0,
p1, t), linearBezier(p1, p2, t), t);
function cubicBezier(p0, p1, p2, p3, t) =
linearBezier(quadraticBezier(p0,
p1, p2, t), quadraticBezier(p1, p2, p3, t), t);
where all 3 functions take an argument t which is between 0 and 1, the
fraction of the path along the curve.
linearBezier (only named that for consistency, and I thought it was funny)
finds a linear interpretation between two points, quadraticBezier finds
the point along the parabolic segment defined by the 3 points, and
cubicBezier (the one normally used in most graphical applications) finds
the point along the cubic curve defined by the 4 points.
On Thu, Jan 28, 2021 at 6:49 PM Lou_Papet <
I agree with you. I will perhaps surprise you but I do not appreciate
what
is done today, especially in the automobile sector without taking the
electric ones which are, for me of course, an hoax against the planet!
...
My 2CV is 42 yeaers old !...
"Pourquoi faire simple quand on peut faire encore plus simple !..."
"Why keep it simple when you can make it even simpler ! ..."
"Le plus simple est de ne pas faire.....seulement si c'est possible !..."
"The easiest way is not to do ..... only if it is possible ! ..."
Sent from the OpenSCAD mailing list archive
<http://forum.openscad.org/>
at Nabble.com.
OpenSCAD mailing list
On the matter of beziers I found that the fastest way to calculate them in
OpenSCAD is using the matrix representation, which isn't commonly discussed.
If you can do something with matrices it will almost always be the fastest
method in OpenSCAD. I changed the BOSL2 general order N bezier from the
recursive de Casteljau method (that you have below) to the matrix method and
got a 10-20 times speed improvement, which can make a difference when doing
bezier surfaces with lots of points. The continuous curvature rounding
stuff I did required 4th order beziers.
acwest wrote
> On the subject of bezier's, I implemented them in my own libraries with:
>
> function linearBezier(p0, p1, t) = p0 + (p1 - p0) * t;
>>
>> function quadraticBezier(p0, p1, p2, t) = linearBezier(linearBezier(p0,
>> p1, t), linearBezier(p1, p2, t), t);
>>
>> function cubicBezier(p0, p1, p2, p3, t) =
>> linearBezier(quadraticBezier(p0,
>> p1, p2, t), quadraticBezier(p1, p2, p3, t), t);
>>
>
> where all 3 functions take an argument t which is between 0 and 1, the
> fraction of the path along the curve.
> linearBezier (only named that for consistency, and I thought it was funny)
> finds a linear interpretation between two points, quadraticBezier finds
> the point along the parabolic segment defined by the 3 points, and
> cubicBezier (the one normally used in most graphical applications) finds
> the point along the cubic curve defined by the 4 points.
>
> On Thu, Jan 28, 2021 at 6:49 PM Lou_Papet <
> loupapetjpr@
> > wrote:
>
>> I agree with you. I will perhaps surprise you but I do not appreciate
>> what
>> is done today, especially in the automobile sector without taking the
>> electric ones which are, for me of course, an hoax against the planet!
>> ...
>> My 2CV is 42 yeaers old !...
>> "Pourquoi faire simple quand on peut faire encore plus simple !..."
>> *"Why keep it simple when you can make it even simpler ! ..."*
>> "Le plus simple est de ne pas faire.....seulement si c'est possible !..."
>> *"The easiest way is not to do ..... only if it is possible ! ..."*
>>
>> ------------------------------
>> Sent from the OpenSCAD mailing list archive
>> <http://forum.openscad.org/>
>> at Nabble.com.
>> _______________________________________________
>> OpenSCAD mailing list
>>
> Discuss@.openscad
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@.openscad
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Sent from: http://forum.openscad.org/
JR
Jean-Pierre Rousset
Fri, Jan 29, 2021 7:23 AM
Yes, it is a mathematical game allowed by the formulation of Bézier curves
but I believe that the most used are cubic Bézier curves to concatenate,
easier to handle especially for Bézier surfaces and used in a large part of
3D softwares with the B-splines.
Le ven. 29 janv. 2021 à 03:12, A. Craig West acraigwest@gmail.com a
écrit :
On the subject of bezier's, I implemented them in my own libraries with:
function linearBezier(p0, p1, t) = p0 + (p1 - p0) * t;
function quadraticBezier(p0, p1, p2, t) = linearBezier(linearBezier(p0,
p1, t), linearBezier(p1, p2, t), t);
function cubicBezier(p0, p1, p2, p3, t)
= linearBezier(quadraticBezier(p0, p1, p2, t), quadraticBezier(p1, p2, p3,
t), t);
where all 3 functions take an argument t which is between 0 and 1, the
fraction of the path along the curve.
linearBezier (only named that for consistency, and I thought it was funny)
finds a linear interpretation between two points, quadraticBezier finds
the point along the parabolic segment defined by the 3 points, and
cubicBezier (the one normally used in most graphical applications) finds
the point along the cubic curve defined by the 4 points.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
"Pourquoi faire simple quand on peut faire encore plus simple..." "Le plus
simple est de ne pas faire.....seulement si c'est possible !..."
Yes, it is a mathematical game allowed by the formulation of Bézier curves
but I believe that the most used are cubic Bézier curves to concatenate,
easier to handle especially for Bézier surfaces and used in a large part of
3D softwares with the B-splines.
Le ven. 29 janv. 2021 à 03:12, A. Craig West <acraigwest@gmail.com> a
écrit :
> On the subject of bezier's, I implemented them in my own libraries with:
>
> function linearBezier(p0, p1, t) = p0 + (p1 - p0) * t;
>>
>> function quadraticBezier(p0, p1, p2, t) = linearBezier(linearBezier(p0,
>> p1, t), linearBezier(p1, p2, t), t);
>>
>> function cubicBezier(p0, p1, p2, p3, t)
>> = linearBezier(quadraticBezier(p0, p1, p2, t), quadraticBezier(p1, p2, p3,
>> t), t);
>>
>
> where all 3 functions take an argument t which is between 0 and 1, the
> fraction of the path along the curve.
> linearBezier (only named that for consistency, and I thought it was funny)
> finds a linear interpretation between two points, quadraticBezier finds
> the point along the parabolic segment defined by the 3 points, and
> cubicBezier (the one normally used in most graphical applications) finds
> the point along the cubic curve defined by the 4 points.
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
--
*"Pourquoi faire simple quand on peut faire encore plus simple..." "Le plus
simple est de ne pas faire.....seulement si c'est possible !..."*