Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4266528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:46:21+00:00 2026-05-21T06:46:21+00:00

I am building a JavaScript module to add convenience functions to the HTML5 canvas

  • 0

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 project page and my examples page.

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:

  • Is there any difference in margin for error when approximating a circle? An ellipse?
  • Is there any reason to have both implementations? (performance, accuracy, etc)
  • Am I missing any other methods for drawing ellipses?

P.S. This isn’t directly related, but are there any other functions that would be nice to have in such a module?

Note: This is not a homework assignment.

EDIT: Here is my code for an ellipse (xDis is radius in x, yDis is radius in y):

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);
}

Related questions:

Convert a quadratic bezier to a cubic?

https://stackoverflow.com/questions/2688808/drawing-quadratic-bezier-circles-with-a-given-radius-how-to-determine-control-po

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:46:22+00:00Added an answer on May 21, 2026 at 6:46 am

    A cubic Bezier curve has two more degrees of freedom than a quadratic one. It can thus reduce error further. Though the math for choosing the control-points gets more complex the higher the degree of the curve, a cubic curve should be simple enough.

    The difference in performance is not much. A few more multiplications and additions.

    Although this could be achieved by rotating the plane, it would be nice to be able to specify the axes of the ellipse. A center, and two axes would form the ellipse center + cos(t)*axis1 + sin(t)*axis2.

    Another feature of the library could be different kinds of polynomial curves and splines. A B-spline is similar to a Bezier curve, but can continue along multiple control points.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a game in HTML5 and JavaScript. Is there any sort of
I'm planning on building a JavaScript, html5, nodejs based game. I know that Nodejs
I'm trying to wrap my head around building a custom JavaScript library. I've read
I am building a javascript widget and i need to add my widget css
I have been using PHP and JavaScript for building my dad's website. He wants
I'm working on building a development tool that is written in JavaScript. This will
I am building a Facebook App which is heavy on Javascript. For this I
I'm building a concert calendar that's very heavy on javascript (using jQuery). I'm having
When building code like this: <script type=text/javascript src=<%=ResolveUrl(~/js/js.js)%>></script> or <input type=image src=<%=ResolveUrl(~/img/submit.png)%> /> Should
I'm currently building a small web application that includes a fair amount of JavaScript.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.