Pointlist to Bezier?

-hh hh at livecode.org
Mon Dec 7 16:18:37 EST 2015


Hi Michael and all,

meanwhile I looked closer at the math of the two algorithms that Alejandro implemented.

TMO, this is the answer, no matter if you wish to approximate/smooth bezier-curves or any other path by curves of lower/higher order:

[1] If you have not too much points, say an N-gon with N <= 32, then the two (very good) by Alejandro implemented algorithms are better, although they produce a lot of points. One can see that also in Alejandro's demo-stack.

[2] For smoothing "nasty" lists, like hand-drawing, the methods I used seem to do a slightly better job. They need more time for the 'preparation' of smoothing but also produce a smaller amount of points (less points than the input).


You can compare the three methods by yourself with the updated "krikelKrakel" (the input stack is downloadable there):
http://www.hyperhh.org/html5/krikelKrakel2a-8.0.0-dp-9X.html

May be --- I hope so --- Alejandro will improve the usage of 'his' two algorithms in the card's script or even make a better one.

> Michael K. wrote:
> I might not have been precise enough….what I meant was:
> To a given curve (or pointlist) which bezier will fit it.
> Kind of reverse-engeneering beziers

Feel free to change the script, for example in order to use some approximate bezier curves of "any" order (square, cubic,...) as input instead of the drawn user-points ( which are collected by mouseMove).

And please show us the result if you succeed with your changes.

If you mean by "reverse-engineering beziers" to find out from alist of points the curve-type "Bezier", the order of it and the control points, then this is far out of my mathematical horizon (approximating closely yes, but not finding out the exact model).

Hermann

p.s. The approach of Scott R. is a really clever one for *drawing /visualizing* (cubic) bezier curves. For approximation by such curves I don't understand until now what the advantage of using 'behaviour' could be.





More information about the use-livecode mailing list