Reputation: 40496
I am trying to create a perfect right half circle of 15 points radius with CGPathAddCurveToPoint, like this:
CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddCurveToPoint(path, NULL, 15, 0, 15, 30, 0, 30);
It starts at the top middle of the circle. Then the first control point is set to the top right corner of the circle's bounding box. The second control point is set to the bottom right corner of the circle's bounding box. The circle ends at bottom middle of the bounding box.
But when drawn, the circle has an egg-like shape.
How can I make a perfect, flawless right semisphere starting at point 0,0 going to the right and ending at 0,30?
Upvotes: 3
Views: 4287
Reputation: 57149
CGPathAddCurveToPoint
creates a Bézier curve, not a circular arc. The method you’re looking for is CGPathAddArc
or CGPathAddArcToPoint
, as below:
CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddArc(path, NULL, 0, 15, 15, M_PI_2, -M_PI_2, true);
Upvotes: 5