Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Determine the large-arc-flag in Path Arc

Tags:

html

svg

I have the two coordinate start(x1,y1) end(x2,y2) and circle(c1,c2)

x1, y1, x2, y2, c1, c2, radius, clockwise

I want to draw an arc, from (x1,y1) to (x2,y2), I think the SVG Path is

M x1 y1 A radius radius 0 ? clockwise x2 y2

But How Can I Determine the large-arc-flag is 1 or 0, thanks.

like image 587
Abel Avatar asked Oct 28 '25 12:10

Abel


1 Answers

The diagram in this section of the spec pretty much explains what is going on.

http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands

If you have a start point, end point, and a radius, then the arc between those points is either going to be a small arc (<180deg) or a large arc (>180deg - the long way around the circle). That's assuming the centre of the circle isn't directly between the two points, of course.

In most cases you probably want the short-cut. That is, large-arc-flag = 0.

Normally it is the other flag, sweep, which is the trickier one.

like image 58
Paul LeBeau Avatar answered Oct 30 '25 01:10

Paul LeBeau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!