[Bug 23392] New: request: elliptical arc

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23392

            Bug ID: 23392
           Summary: request: elliptical arc
           Product: HTML WG
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: CR HTML Canvas 2D Context
          Assignee: jaymunro@microsoft.com
          Reporter: pomax@nihongoresources.com
        QA Contact: public-html-bugzilla@w3.org
                CC: public-html-admin@w3.org

With the ellipse() function now part of the
http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas draft, it is surprising
to see there is no elliptical arc command. I'd like to request for
consideration the addition of two commands for elliptical arcs, as they are a
superset of circular arcs and allow for much better curve work than using
transformed circular arcs, and much faster curve work than beziers.


(1) context . ellipticArc(x, y, xRadius, yRadius, startAngle, endAngle,
ellipseAngle [, anticlockwise ] )

A counterpart (and superfunction) of the regular arc command. If
xRadius==yRadius, then this is identical to arc(), otherwise this will draw a
(section of) an ellipse, itself rotated about x/y at a specific angle to cover
all possible arcs.

(2) context . arcBetween(cx, cy, startx, starty, endx, endy)

this would draw an arc from start x/y to end x/y, over center point cx/cy, with
the arcing parameters derived from these three coordinates so that canvas users
don't need to calculate these. Often users don't actually want to compute exact
angles, they care more about the arc lining up with specific coordinates.
Having a coordinates-only function would be quite useful.

While in principle similar to drawing a Bezier from start x/y to end x/y with
control points chosen so that the curve start/end tangents are correctly
aligned, the math for exact arc fitting is much faster than for deriving the
correct high-order bezier (necessary as a bezier curve cannot actually model an
elliptical curve, a cubic curve can only approximate a little over a quarter
turn before become obviously visibly wrong, and an implementation would have to
derive multiple beziers to render the arc).

---

Use cases for both are simply improved shaping tools as part of the toolset
offered by the canvas2d API. The lack of any elliptical arc means code that
needs them (canvas games or anything pathed-based graphics in the canvas,
really) currently uses artificial and very expensive code to model and render
what are in essence very cheap curves. Particularly the auto-fitting arc
function would make life a lot easier.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Sunday, 29 September 2013 16:53:38 UTC