public function arc($x, $y, $radius, $startAngle, $endAngle, $anticlockwise) 
    {
        $TARGET_CHORD_LENGTH_PIXELS = 3;
        
        $sectors = floor((M_PI * $radius * 2) / $TARGET_CHORD_LENGTH_PIXELS);
        if ($sectors < 9) {
            $sectors = 9;
        }
        
        $sectorAngle = M_PI * 2 / $sectors;

        if ($startAngle == $endAngle) {
            return;
        }

        if ($anticlockwise) {
            $sectorAngle = -$sectorAngle;

            if ($startAngle - $endAngle >= M_PI * 2) {
                $endAngle = $startAngle - M_PI * 2;
            } else {
                // Normalize end angle so that the sweep angle is in the range 
                // (0, -2PI]
                $endAngle += 
                    M_PI * 2 * ceil(($startAngle - $endAngle) / 
                    (M_PI * 2) - 1);
            }
        } else {
            if ($endAngle - $startAngle >= M_PI * 2) {
                $endAngle = $startAngle + M_PI * 2;
            } else {
                // Normalize end angle so that the sweep angle is in the range 
                // (0, 2PI]
                $endAngle -= 
                    M_PI * 2 * ceil(($endAngle - $startAngle) / 
                    (M_PI * 2) - 1);
            }
        }
        
        $dx;
        $dy;
        $sectors = ($endAngle - $startAngle) / $sectorAngle;

        $angle = $startAngle;
        
        for ($i = 0; $i < $sectors; $i++) {
            $dx = cos($angle) * $radius;
            $dy = sin($angle) * $radius;
            $this->lineTo($x + $dx, $y + $dy);
            $angle += $sectorAngle;
        }

        $dx = cos($endAngle) * $radius;
        $dy = sin($endAngle) * $radius;
        $this->lineTo($x + $dx, $y + $dy);
    }
public function arc($x, $y, $radius, $startAngle, $endAngle, $anticlockwise) 
    {
        $TARGET_CHORD_LENGTH_PIXELS = 3;
        
        $sectors = floor((M_PI * $radius * 2) / $TARGET_CHORD_LENGTH_PIXELS);
        if ($sectors < 9) {
            $sectors = 9;
        }
        
        $sectorAngle = M_PI * 2 / $sectors;

        if ($startAngle == $endAngle) {
            return;
        }

        if ($anticlockwise) {
            $sectorAngle = -$sectorAngle;

            if ($startAngle - $endAngle >= M_PI * 2) {
                $endAngle = $startAngle - M_PI * 2;
            } else {
                // Normalize end angle so that the sweep angle is in the range 
                // (0, -2PI]
                $endAngle += 
                    M_PI * 2 * ceil(($startAngle - $endAngle) / 
                    (M_PI * 2) - 1);
            }
        } else {
            if ($endAngle - $startAngle >= M_PI * 2) {
                $endAngle = $startAngle + M_PI * 2;
            } else {
                // Normalize end angle so that the sweep angle is in the range 
                // (0, 2PI]
                $endAngle -= 
                    M_PI * 2 * ceil(($endAngle - $startAngle) / 
                    (M_PI * 2) - 1);
            }
        }
        
        $dx;
        $dy;
        $sectors = ($endAngle - $startAngle) / $sectorAngle;

        $angle = $startAngle;
        
        for ($i = 0; $i < $sectors; $i++) {
            $dx = cos($angle) * $radius;
            $dy = sin($angle) * $radius;
            $this->lineTo($x + $dx, $y + $dy);
            $angle += $sectorAngle;
        }

        $dx = cos($endAngle) * $radius;
        $dy = sin($endAngle) * $radius;
        $this->lineTo($x + $dx, $y + $dy);
    }
public function arc ( $ x , $ y , $ radius , $ startAngle , $ endAngle , $ anticlockwise ) { $ TARGET_CHORD_LENGTH_PIXELS = 3 ; $ sectors = floor ( ( M_PI * $ radius * 2 ) / $ TARGET_CHORD_LENGTH_PIXELS ) ; if ( $ sectors < 9 ) { $ sectors = 9 ; } $ sectorAngle = M_PI * 2 / $ sectors ; if ( $ startAngle == $ endAngle ) { return ; } if ( $ anticlockwise ) { $ sectorAngle = - $ sectorAngle ; if ( $ startAngle - $ endAngle >= M_PI * 2 ) { $ endAngle = $ startAngle - M_PI * 2 ; } else { // Normalize end angle so that the sweep angle is in the range  // (0, -2PI] $ endAngle += M_PI * 2 * ceil ( ( $ startAngle - $ endAngle ) / ( M_PI * 2 ) - 1 ) ; } } else { if ( $ endAngle - $ startAngle >= M_PI * 2 ) { $ endAngle = $ startAngle + M_PI * 2 ; } else { // Normalize end angle so that the sweep angle is in the range  // (0, 2PI] $ endAngle -= M_PI * 2 * ceil ( ( $ endAngle - $ startAngle ) / ( M_PI * 2 ) - 1 ) ; } } $ dx ; $ dy ; $ sectors = ( $ endAngle - $ startAngle ) / $ sectorAngle ; $ angle = $ startAngle ; for ( $ i = 0 ; $ i < $ sectors ; $ i ++ ) { $ dx = cos ( $ angle ) * $ radius ; $ dy = sin ( $ angle ) * $ radius ; $ this -> lineTo ( $ x + $ dx , $ y + $ dy ) ; $ angle += $ sectorAngle ; } $ dx = cos ( $ endAngle ) * $ radius ; $ dy = sin ( $ endAngle ) * $ radius ; $ this -> lineTo ( $ x + $ dx , $ y + $ dy ) ; }
Adds an arc to the current path.

@param float $x  X coordinate of the center of the arc.
@param float $y  Y coordinate of the center of the arc.
@param float $radius  Radius of the arc.
@param float $startAngle  The angle in radians at which the arc starts,
measured clockwise from the positive x axis.
@param float $endAngle  The angle in radians at which the arc end,
measured clockwise from the positive x axis.
@param boolean $anticlockwise  Specifies whether the arc will be drawn
counter clockwise. Default is clockwise.
Adds an arc to the current path .