package image;

import stdlib.StdDraw;

/**
 *  Plots a parametric figure which A. K. Dewdney refers to as
 *  Miller's Madness.
 *
 *  Reference: The Magic Machine by A. K. Dewdney. This figure
 *  was designed by Stanley S. Miller, a management consultant.
 */
public class Madness {

   public static void main(String[] args) {
   	  StdDraw sd = new StdDraw();
      sd.setXscale(-1.7, +1.7);
      sd.setYscale(-1.1, +1.1);
      double x0 = -0.7, y0 = 1.0;
      for (double t = 0.0; true; t += 0.01) {
          double x1 = Math.sin(0.99*t) - 0.7*Math.cos(3.01*t);
          double y1 = Math.cos(1.01*t) + 0.1*Math.sin(15.03*t);
          sd.line(x0, y0, x1, y1);
          x0 = x1;
          y0 = y1;
      }
   }
}
