title: Draw ellipse with start and end angle in Objective-C
body: <p>I am writing an iPad app in which I am rendering XML objects that represent shapes into graphics on the screen. One of the objects I am trying to render is arcs. Essentially these arcs provide me with a bounding rectangle as well as a start and end angle.</p>
  
  <p>Given attributes:</p>
  
  <ul>
  <li>x</li>
  <li>y</li>
  <li>width</li>
  <li>height</li>
  <li>startAngle</li>
  <li>endAngle</li>
  </ul>
  
  <p>With these values I need to draw the arc (which is essentially part of an ellipse). I can not use the following:</p>
  
  <pre><code>    UIBezierPath *arc = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x, y, width, height)];
      [UIColor blackColor] setStroke];
      [arc stroke];
  </code></pre>
  
  <p>because it draws a full ellipse. Basically I need the above but it needs to take into account the start and end angles so only part of the ellipse is displayed. I am thinking this will involve either drawing a cubic Bezier curve or a quadratic Bezier curve. The problem is I have no clue how to calculate the start point, end point, or control points with the information I am given.</p>