I think one could argue that the current formula for calculating the
error, tail_error(B, 2), in build_from_sbasis() in sbasis-to-bezier.cpp is
unnecessarily pessimistic, due to recent changes in the code. The tolerance
on the error is 0.1. The error is linear in the radius of the arc. The
dividing point in switching from 4 beziers to 8, for a full circle, occurs
at r = 8.18. The dividing point in switching from 8 beziers to 16, for a
full circle, occurs at r = 107.4. This can be confirmed using
Path->Object-To-Path.
Numerical tests at different arc angles have indicated that the
tail_error function is roughly given by 0.0026*r*(theta)^4, where theta is
in radians. This is consistent with the way in which the Bezier
approximation used to be done. Recalling a previous thread on this subject:

http://article.gmane.org/gmane.comp.graphics.inkscape.devel/35435
the arm length of the Bezier approximation to an arc was given by:
d/r = theta/3, where d = Bezier control arm length
The resulting fit will be worst at t=0.5 and the Bezier radius at this point
will be:
r(t = 0.5) = cos(theta/2) + (theta/4)*sin(theta/2)
The error, for a unit circle, is roughly given by:
error = -(theta)^4/24/16
which is consistent with the previous numerical tests of tail_error.
The code in sbasis-to-bezier.cpp has been modifed (lib2geom rev 2122) to
use a different approach to the fit, one which fits the sbasis curve at
t=0.5. In the case of arcs, this is consistent with a Bezier arm length of:
d/r = 4*tan(theta/4)/3
The Bezier radius will be correct at t = 0, 0.5, and 1. The maximum error in
radius will occur at t values which satisfy the equation 6*t*(1-t) = 1. The
maximum radius is given by:
r^2 = 1 + (4/27)*(sin(theta/4))^6/(cos(theta/4))^2
The error, for a unit circle, is roughly given by:
error = (2/27)*(theta/4)^6
This is significantly smaller than the previous estimate (about 55 times
smaller for an arc of 90 degrees), and would allow larger arc radii to be
used without subdivision of the Bezier curves.
Unfortunately, I do not have sufficient math fu to do this type of analysis
directly in the sbasis representation, but I think it would be worthwhile to
try to perform such an error analysis.
Cheers,
Alvin
--
View this message in context:

http://inkscape.13.x6.nabble.com/Recent-change-to-ellipse-to-path-convers...
Sent from the Inkscape - Dev mailing list archive at

Nabble.com.