src/modules/context2d.js
function (radius, startAngle, endAngle, anticlockwise) {
        var EPSILON = 0.00001; // Roughly 1/1000th of a degree, see below 
        var twoPi = Math.PI * 2;
        var halfPi = Math.PI / 2.0;

        while (startAngle > endAngle) {
            startAngle = startAngle - twoPi;
        }
        var totalAngle = Math.abs(endAngle - startAngle);
        if (totalAngle < twoPi) {
            if (anticlockwise) {
                totalAngle = twoPi - totalAngle;
            }
        }

        // Compute the sequence of arc curves, up to PI/2 at a time.
        var curves = [];

        // clockwise or counterclockwise
        var sgn = anticlockwise ? -1 : +1;

        var a1 = startAngle;
        for (; totalAngle > EPSILON;) {
            var remain = sgn * Math.min(totalAngle, halfPi);
            var a2 = a1 + remain;
            curves.push(createSmallArc.call(this, radius, a1, a2));
            totalAngle -= Math.abs(a2 - a1);
            a1 = a2;
        }

        return curves;
    }
function (radius, startAngle, endAngle, anticlockwise) {
        var EPSILON = 0.00001; // Roughly 1/1000th of a degree, see below 
        var twoPi = Math.PI * 2;
        var halfPi = Math.PI / 2.0;

        while (startAngle > endAngle) {
            startAngle = startAngle - twoPi;
        }
        var totalAngle = Math.abs(endAngle - startAngle);
        if (totalAngle < twoPi) {
            if (anticlockwise) {
                totalAngle = twoPi - totalAngle;
            }
        }

        // Compute the sequence of arc curves, up to PI/2 at a time.
        var curves = [];

        // clockwise or counterclockwise
        var sgn = anticlockwise ? -1 : +1;

        var a1 = startAngle;
        for (; totalAngle > EPSILON;) {
            var remain = sgn * Math.min(totalAngle, halfPi);
            var a2 = a1 + remain;
            curves.push(createSmallArc.call(this, radius, a1, a2));
            totalAngle -= Math.abs(a2 - a1);
            a1 = a2;
        }

        return curves;
    }
Return a array of objects that represent bezier curves which approximate the circular arc centered at the origin, from startAngle to endAngle (radians) with the specified radius.

Each bezier curve is an object with four points, where x1,y1 and x4,y4 are the arc's end points and x2,y2 and x3,y3 are the cubic bezier's control points.
@function createArc