I need this primarily for some freehand drawing experiments. You give it an array of digitised mouse/touch coordinates and the output is a path consisting of smooth cubic bezier segments. My understanding this is knows as Curve Fitting (https://en.wikipedia.org/wiki/Curve_fitting).After some googling around it turns most implementations are based on some variation of Philip J. Schneider Fit Curve algorithm described in Graphics Gems, 1990.Some other vector libs I payed with in the past like e.g. Inkscape lib2geom have this functionality out of the box. I'm not quite sure how to integrate something similar with Skia.BTW another useful basic API I seems can't locate in Skia is finding the overall path contour length and also finding a point on the path contour at a specified percentage of path length. Had a good look through documentation and headers and seems can't find anything of a sort. Am I missing something obvious or such API doesn't exist?
Thank you Hal!On Sunday, 2 September 2018 14:13:58 UTC+1, Hal Canary wrote:It sounds like you might want to computer a cubic b-spline from your data, then represent it as a sequence of cubic curves.I suspect the math to do that is straightforward, but I don't know how off the top of my head.Skia does not, as far as I know, have such functionality now. But I can see how useful it might be for nicely displaying the graph of a smooth function at high resolution, but only calculating a finite number of function values ahead of time. I've wanted something like that before.On Sun, Sep 2, 2018, 06:37 voidcoder <void...@gmail.com> wrote:Dear Skia communityDoes anyone know about a built-in Skia API, primitive, reference code or example on implementing 'curve fitting' with Skia? This is a fairly common vector task. Given an array of SkPoints points or a linear SkPath consisting of line segments turn it into a smoothed rounded SkPath.Thanks for any pointers!
--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.
--
You are a star! Nice and clean. Thanks a lot Hal!Perhaps this can be integrated into Skia lib at some point.
On Monday, 3 September 2018 19:52:03 UTC+1, Hal Canary wrote:
I had to hack something up on my day off:
--