VML path error (and patch) #122

jvenema opened this Issue Jan 17, 2010 · 1 comment

2 participants


Hey folks,

I've tried posting to the discussion group, but apparently my post needs to be approved :).

Anyway, there is a bug in the a2c function for converting "arc" segments in IE/VML. The problem is radii are out of range under certain conditions, resulting in incorrect values for the arc.

The solution is fairly simple, picked up from the W3C spec page.I'm not sure how to submit a patch here, so I've inlined the modifiations. Approximately line 582:

rx = mmax(rx, math.abs(x));
ry = mmax(ry, math.abs(y));

var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
if(h > 1){
rx = math.sqrt(h) * rx;
ry = math.sqrt(h) * ry;

var rx2 = rx * rx,


A test case for this issue is:

  ['M', 20, 20],
  ['A', 20, 20, 0, 1, 0, 60, 60],
  ['A', 20, 20, 0, 0, 0, 20, 20]
]).attr({ stroke: '#f00', 'stroke-width': 3, 'stroke-linecap': 'round' });

Without the patch, that draws a weird line in IE. With the patch, it draws a circle.

For details on the patch, see F.6.6 Correction of out-of-range radii of the w3c spec located at http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes



This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment