title: Drawing ellipses with quadratic bezier curves and cubic bezier curves
body: <p>I am building a JavaScript module to add convenience functions to the HTML5 canvas element.  I am trying to give as many different implementations as possible to fill out my module.  To see my progress, please visit my <a href="https://github.com/beatgammit/libcanvas" rel="nofollow noreferrer">project page</a> and my <a href="http://beatgammit.github.com/libcanvas/" rel="nofollow noreferrer">examples page</a>.</p>
  
  <p>I have an ellipse drawing method that uses cubic bezier curves.  I know that quadratic bezier curves can be converted to cubic bezier curves, but I have some questions:</p>
  
  <ul>
  <li>Is there any difference in margin for error when approximating a circle? An ellipse?</li>
  <li>Is there any reason to have both implementations? (performance, accuracy, etc)</li>
  <li>Am I missing any other methods for drawing ellipses?</li>
  </ul>
  
  <p>P.S. This isn't directly related, but are there any other functions that would be nice to have in such a module?</p>
  
  <p>Note: This is <strong>not</strong> a homework assignment.</p>
  
  <p>EDIT: Here is my code for an ellipse (xDis is radius in x, yDis is radius in y):</p>
  
  <pre><code>function ellipse(x, y, xDis, yDis) {
      var kappa = 0.5522848, // 4 * ((√(2) - 1) / 3)
          ox = xDis * kappa,  // control point offset horizontal
          oy = yDis * kappa,  // control point offset vertical
          xe = x + xDis,      // x-end
          ye = y + yDis;      // y-end
  
      this.moveTo(x - xDis, y);
      this.bezierCurveTo(x - xDis, y - oy, x - ox, y - yDis, x, y - yDis);
      this.bezierCurveTo(x + ox, y - yDis, xe, y - oy, xe, y);
      this.bezierCurveTo(xe, y + oy, x + ox, ye, x, ye);
      this.bezierCurveTo(x - ox, ye, x - xDis, y + oy, x - xDis, y);
  }
  </code></pre>
  
  <p>Related questions:</p>
  
  <p><a href="https://stackoverflow.com/questions/3162645/convert-a-quadratic-bezier-to-a-cubic">Convert a quadratic bezier to a cubic?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2688808/drawing-quadratic-bezier-circles-with-a-given-radius-how-to-determine-control-po">https://stackoverflow.com/questions/2688808/drawing-quadratic-bezier-circles-with-a-given-radius-how-to-determine-control-po</a></p>