PennDraw.java
// helper function for drawing ellipses and filled ellipses
helper function for drawing ellipses and filled ellipses
helper function for drawing ellipses and filled ellipses
private static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis, boolean filled) {
        if (semiMajorAxis < 0) throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative");
        if (semiMinorAxis < 0) throw new IllegalArgumentException("ellipse semiminor axis must be nonnegative");
        double xs = scaleX(x);
        double ys = scaleY(y);
        double ws = factorX(2 * semiMajorAxis);
        double hs = factorY(2 * semiMinorAxis);
        if (ws <= 1 && hs <= 1) pixel(x, y);
        else if (filled)        offscreen.fill(new Ellipse2D.Double(xs - ws / 2, ys - hs / 2, ws, hs));
        else                    offscreen.draw(new Ellipse2D.Double(xs - ws / 2, ys - hs / 2, ws, hs));
        draw();
    }
private static void ellipse ( double x , double y , double semiMajorAxis , double semiMinorAxis , boolean filled ) { if ( semiMajorAxis < 0 ) throw new IllegalArgumentException ( "ellipse semimajor axis must be nonnegative" ) ; if ( semiMinorAxis < 0 ) throw new IllegalArgumentException ( "ellipse semiminor axis must be nonnegative" ) ; double xs = scaleX ( x ) ; double ys = scaleY ( y ) ; double ws = factorX ( 2 * semiMajorAxis ) ; double hs = factorY ( 2 * semiMinorAxis ) ; if ( ws <= 1 && hs <= 1 ) pixel ( x , y ) ; else if ( filled ) offscreen . fill ( new Ellipse2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs ) ) ; else offscreen . draw ( new Ellipse2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs ) ) ; draw ( ) ; }
helper function for drawing ellipses and filled ellipses
helper function for drawing ellipses and filled ellipses