src/main/java/org/teachingextensions/logo/utils/MazeUtils/StdDraw.java
public static void polygon(double[] x, double[] y)
  {
    if (x == null)
      throw new NullPointerException();
    if (y == null)
      throw new NullPointerException();
    int n1 = x.length;
    int n2 = y.length;
    if (n1 != n2)
      throw new IllegalArgumentException("arrays must be of the same length");
    int n = n1;
    GeneralPath path = new GeneralPath();
    path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0]));
    for (int i = 0; i < n; i++)
      path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i]));
    path.closePath();
    offscreen.draw(path);
    draw();
  }
public static void polygon(double[] x, double[] y)
  {
    if (x == null)
      throw new NullPointerException();
    if (y == null)
      throw new NullPointerException();
    int n1 = x.length;
    int n2 = y.length;
    if (n1 != n2)
      throw new IllegalArgumentException("arrays must be of the same length");
    int n = n1;
    GeneralPath path = new GeneralPath();
    path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0]));
    for (int i = 0; i < n; i++)
      path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i]));
    path.closePath();
    offscreen.draw(path);
    draw();
  }
Draws a polygon with the vertices
(<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>),
(<em>x</em><sub>1</sub>, <em>y</em><sub>1</sub>), ...,
(<em>x</em><sub><em>n</em>&minus;1</sub>, <em>y</em><sub><em>n</em>&minus;1</sub>).

@param  x an array of all the <em>x</em>-coordinates of the polygon
@param  y an array of all the <em>y</em>-coordinates of the polygon
@throws IllegalArgumentException unless {@code x[]} and {@code y[]}
are of the same length