When drawing an arc using CGContextAddArcToPoint(), what does (x1,y1) and (x2,y2) mean?

Vineesh TP picture Vineesh TP · Jan 3, 2012 · Viewed 12k times · Source

You can use the following code to draw an arc using Quartz:

CGContextMoveToPoint(context2, x, y);
CGContextAddArcToPoint(context2, x1, y1, x2, y2, r);

In these functions, (x,y) is the starting point and r is the arc radius but what are (x1,y1) and (x2,y2)?

Answer

James Snook picture James Snook · Sep 24, 2013

AddArcToPoint works like this:

ArcToPoint Diagram

where P1 is the point the path is currently at, r is the radius given to the function, and the red line is the line that addArcToPoint will add to the current path. It won't continue to the second point at x2, y2; it will stop at the end of the arc.

I have a blog post about this here.