src/main/java/org/teachingextensions/logo/utils/MazeUtils/StdDraw.java
public static void rectangle(double x, double y, double halfWidth, double halfHeight)
  {
    if (!(halfWidth >= 0))
      throw new IllegalArgumentException("half width must be nonnegative");
    if (!(halfHeight >= 0))
      throw new IllegalArgumentException("half height must be nonnegative");
    double xs = scaleX(x);
    double ys = scaleY(y);
    double ws = factorX(2 * halfWidth);
    double hs = factorY(2 * halfHeight);
    if (ws <= 1 && hs <= 1)
      pixel(x, y);
    else
      offscreen.draw(new Rectangle2D.Double(xs - ws / 2, ys - hs / 2, ws, hs));
    draw();
  }
public static void rectangle(double x, double y, double halfWidth, double halfHeight)
  {
    if (!(halfWidth >= 0))
      throw new IllegalArgumentException("half width must be nonnegative");
    if (!(halfHeight >= 0))
      throw new IllegalArgumentException("half height must be nonnegative");
    double xs = scaleX(x);
    double ys = scaleY(y);
    double ws = factorX(2 * halfWidth);
    double hs = factorY(2 * halfHeight);
    if (ws <= 1 && hs <= 1)
      pixel(x, y);
    else
      offscreen.draw(new Rectangle2D.Double(xs - ws / 2, ys - hs / 2, ws, hs));
    draw();
  }
Draws a rectangle of the specified size, centered at (<em>x</em>, <em>y</em>).

@param  x the <em>x</em>-coordinate of the center of the rectangle
@param  y the <em>y</em>-coordinate of the center of the rectangle
@param  halfWidth one half the width of the rectangle
@param  halfHeight one half the height of the rectangle
@throws IllegalArgumentException if either {@code halfWidth} or {@code halfHeight} is negative