Comment 15 for bug 1544680

Revision history for this message
Alvin Penner (apenner) wrote :

this code was originally committed to lib2geom in August 15, 2013:
https://github.com/inkscape/lib2geom/commit/e92c13f500f106d520e91be2acd1a284a3184787
and to Inkscape in rev 12921:
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/12921#src/2geom/sbasis-to-bezier.cpp
the original motivation for the change was to improve the rendering of ellipses, since there were a number of bug reports related to the quality of the elliptical arcs. The code will work well for cases where the Bezier arm lengths are roughly similar in size. But it does not do a good job if the arm lengths are highly dissimilar. In the current example, the Bezier curve that is causing the problem has one arm that is about 20 times longer than the other, with the result that the short arm sometimes varies quite wildly in response to a small change in the large arm. I think this will always be a problem if one is using live path effects where the two endpoints of the curve are highly dissimilar. What the patch does is to reject the higher order fit method and revert back to the original zeroth order fit method in this case.
    The current fit method uses the midpoint of the SBasis curve to try to improve the fit, relative to the zeroth order estimate. There are other fit methods that could be used instead. For example, one could fit the curvature at the endpoints, or one could fit the center of mass. I have experimented with both of these methods for curves that are quite well-behaved:
https://github.com/alvinpenner/Spiro2SVG
but I have never attempted to apply them to a situation that is as volatile as a live path effect, so I am not sure if either of them would be consistently better than the current method. It might be an interesting research project for someone to tackle.