* @see <a href="http://timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm">Cubic Bezier in Flash</a>
*/
private void approximateCubicBezier(final Point P0, final Point P1, final Point P2, final Point P3)
{
// calculates the useful base points
Point PA = getPointOnSegment(P0, P1, 3.0 / 4.0);
Point PB = getPointOnSegment(P3, P2, 3.0 / 4.0);
// get 1/16 of the [P3, P0] segment
double dx = (P3.x - P0.x) / 16.0;
double dy = (P3.y - P0.y) / 16.0;
// calculate control point 1
Point c1 = getPointOnSegment(P0, P1, 3.0 / 8.0);
// calculate control point 2
Point c2 = getPointOnSegment(PA, PB, 3.0 / 8.0);
c2.x = c2.x - dx;
c2.y = c2.y - dy;
// calculate control point 3
Point c3 = getPointOnSegment(PB, PA, 3.0 / 8.0);
c3.x = c3.x + dx;
c3.y = c3.y + dy;
// calculate control point 4
Point c4 = getPointOnSegment(P3, P2, 3.0 / 8.0);
// calculate the 3 anchor points (as midpoints of the control segments)
Point a1 = new Point(((c1.x + c2.x) / 2.0), ((c1.y + c2.y) / 2.0));
Point a2 = new Point(((PA.x + PB.x) / 2.0), ((PA.y + PB.y) / 2.0));
Point a3 = new Point(((c3.x + c4.x) / 2.0), ((c3.y + c4.y) / 2.0));
// draw the four quadratic sub-segments
curved(c1.x, c1.y, a1.x, a1.y);
curved(c2.x, c2.y, a2.x, a2.y);
curved(c3.x, c3.y, a3.x, a3.y);