Question

All the docs I've seen for the ArcTo instruction for a SVG <path/>'s d attribute give the first two arguments as the x and y radius of the arc.

Earlier, though, I was playing around, and in FF8 and Safari 5, it seemed like the path

<path d="M 100 100 A 50 50 0 0 0 200 100 Z"/>

and the path

<path d="M 100 100 A 1 1 0 0 0 200 100 Z"/>

rendered identically. From a bit more playing it seemed like what was really being used was the ratio between rx and ry. This makes sense (since what else are you going to do if the current position is more than 2r away), but is it officially documented anywhere?

It'd be nice if I could rely on this behaviour so I didn't have to manually calculate the x and y radius and instead just state their ratio.

Was it helpful?

Solution

Per the SVG specification: If rx, ry are such that there is no solution (basically, the ellipse is not big enough to reach from (x1, y1) to (x2, y2)) then the ellipse is scaled up uniformly until there is exactly one solution (until the ellipse is just big enough).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top