code: private static float[]  arcToBeziers(double angleStart, double angleExtent)
     {
        int    numSegments = (int) Math.ceil(Math.abs(angleExtent) * 2.0 / Math.PI);  // (angleExtent / 90deg)
  
        double  angleIncrement = angleExtent / numSegments;
        
        // The length of each control point vector is given by the following formula.
        double  controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));
        
        float[] coords = new float[numSegments * 6];
        int     pos = 0;
  
        for (int i=0; i<numSegments; i++)
        {
           double  angle = angleStart + i * angleIncrement;
           // Calculate the control vector at this angle
           double  dx = Math.cos(angle);
           double  dy = Math.sin(angle);
           // First control point
           coords[pos++]   = (float) (dx - controlLength * dy);
           coords[pos++] = (float) (dy + controlLength * dx);
           // Second control point
           angle += angleIncrement;
           dx = Math.cos(angle);
           dy = Math.sin(angle);
           coords[pos++] = (float) (dx + controlLength * dy);
           coords[pos++] = (float) (dy - controlLength * dx);
           // Endpoint of bezier
           coords[pos++] = (float) dx;
           coords[pos++] = (float) dy;
        }
        return coords;
     }
docs: /*
  Generate the control points and endpoints for a set of bezier curves that match
  a circular arc starting from angle 'angleStart' and sweep the angle 'angleExtent'.
  The circle the arc follows will be centred on (0,0) and have a radius of 1.0.
  
  Each bezier can cover no more than 90 degrees, so the arc will be divided evenly
  into a maximum of four curves.
  
  The resulting control points will later be scaled and rotated to match the final
  arc required.
  
  The returned array has the format [x0,y0, x1,y1,...] and excludes the start point
  of the arc.