fun circle(x: Double, y: Double, r: Double) { require(r >= 0) { "circle radius must be nonnegative" } val xs: Double = scaleX(x) val ys: Double = scaleY(y) val ws: Double = factorX(2 * r) val hs: Double = factorY(2 * r) if (ws <= 1 && hs <= 1) pixel( x, y ) else offscreen.draw(java.awt.geom.Ellipse2D.Double(xs - ws / 2, ys - hs / 2, ws, hs)) draw() }
Draw a circle of radius r , centered on ( x , y ) .