[cairo] cairo-arc: simplify maximum angle for tolerance calculation

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Thu Aug 25 06:59:04 PDT 2005


I've thought about the error bounds code in cairo-arc.c a bit more
and have come up with a simpler calculation for the maximum angle of
a single segment, _arc_max_angle_for_tolerance_normalized(). See the
attached patch for details.


- The bounds of the function are asymptotically slightly worse than
  the original function's bounds - by a factor of 0.999422.
- The first two values of the original table have been adjusted to
  use the actual error bound instead of the apprixmation.
- The resulting angle will not divide evenly into M_PI; this does not
  matter much because the only user is _arc_segments_needed(), which
  adjusts the angle to divide evenly into the arc to be drawn.
- The patch results in no differences in make check.
- Wouldn't this function be more appropriately named

If anyone has access to the original paper quoted in the comment, I'd be
grateful to know how much of the 'new' stuff is already derived there.

Comments, suggestions, and so on are welcome.

With kind regards,

Bertram Felgenhauer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-arc-to-simplify-error-bound.diff
Type: application/octet-stream
Size: 3209 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050825/d55c7951/cairo-arc-to-simplify-error-bound.obj

More information about the cairo mailing list