PennDraw.java
// common code for all arc functions
common code for all arc functions
common code for all arc functions
private static void arc(double x, double y, double r, double angle1, double angle2, int pathType, boolean fill) {
        if (r < 0) throw new IllegalArgumentException("arc radius must be nonnegative");
        while (angle2 < angle1) angle2 += 360;
        double xs = scaleX(x);
        double ys = scaleY(y);
        double ws = factorX(2*r);
        double hs = factorY(2*r);
        if (ws <= 1 && hs <= 1) {
            pixel(x, y);
        } else {
            if (fill) offscreen.fill(new Arc2D.Double(xs - ws/2, ys - hs/2, ws, hs, angle1, angle2 - angle1, pathType));
            else      offscreen.draw(new Arc2D.Double(xs - ws/2, ys - hs/2, ws, hs, angle1, angle2 - angle1, pathType));
        }
        draw();
    }
private static void arc ( double x , double y , double r , double angle1 , double angle2 , int pathType , boolean fill ) { if ( r < 0 ) throw new IllegalArgumentException ( "arc radius must be nonnegative" ) ; while ( angle2 < angle1 ) angle2 += 360 ; double xs = scaleX ( x ) ; double ys = scaleY ( y ) ; double ws = factorX ( 2 * r ) ; double hs = factorY ( 2 * r ) ; if ( ws <= 1 && hs <= 1 ) { pixel ( x , y ) ; } else { if ( fill ) offscreen . fill ( new Arc2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs , angle1 , angle2 - angle1 , pathType ) ) ; else offscreen . draw ( new Arc2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs , angle1 , angle2 - angle1 , pathType ) ) ; } draw ( ) ; }
common code for all arc functions
common code for all arc functions