- The original ellipse -> bezier conversion used one of the worked out solutions which are calculated directly from the ellipse parameters.
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/12550/src/sp-e...
for (s = this->start; s < this->end; s += M_PI_2) { double e = s + M_PI_2;
if (e > this->end) { e = this->end; }
len = 4*tan((e - s)/4)/3; double x0 = cos(s); double y0 = sin(s); double x1 = x0 + len * cos(s + M_PI_2); double y1 = y0 + len * sin(s + M_PI_2); double x3 = cos(e); double y3 = sin(e); double x2 = x3 + len * cos(e - M_PI_2); double y2 = y3 + len * sin(e - M_PI_2);
curve->curveto(x1,y1, x2,y2, x3,y3); }
It produced four beziers for any ellipse. These met the needs of most users.
That's correct.
- Higher precision curve drawing of ellipses was required by some end users for CAD purposes, so the method was changed.
It wasn't required (it's a nice feature though), but using 2geom for calculation is just so much easier and the preferred way to go: Geom::Circle circle(0, 0, 1); Geom::PathVector path;
circle.getPath(path);
curve = new SPCurve(path); curve->closepath(); That's it.
This resulted in the default bezier representation of an ellipse being more complex (>4 beziers) than needed for general use. The new method uses a fit parameter which must be changed in a major way from its default value in order to return to beziers similar to (1), and there is currently no way to do this in the GUI.
Right.
(Unsure: that same parameter is used for other curve -> bezier conversions? Does the end user need to be able to adjust the fit parameter?)
As soon as you modify a path using the node tool, all the curves the path consists of are converted to cubic Bezier curves. Currently, for all these conversions the fit parameter is 0.1.
The issue then is how to allow those who need it to obtain a higher precision conversion to beziers without requiring that the average user know anything about it. I suggest that the usual solution to this sort of problem, as applied to Inkscape, would be to modify the toolbar for elliptical drawing to add a "precision" field that normally reads "Default", with other options perhaps called "CAD Low","CAD Medium","CAD High". Each corresponds to a parameter value, but that is not shown to the end user, in case things need to be changed around again at some point in future. Exposing the parameter value is unlikely to be helpful to most users, since it probably will not correspond in a simple way to an easily comprehended measure of error. The bezier generating code looks at this parameter, and when it sees the one corresponding to "Default" it uses the original algorithm, for all of the others it uses Geom::cubicbezierpath_from_sbasis.
Putting the precision settting into the settings dialog seems better to me. Either you need to increase it or you don't. Usually, you won't change it all the time. So the average user won't even notice this option exists.
Regards, Markus