import std.math;
import Dislin;

void main (string[] args)
{ int i, j, n = 50;
  float [50][50] zmat;
  float [50] xray, yray;
  float [12] zlev;
  double step, x, y;

  step = 1.6 / (n-1);
  for (i = 0; i < n; i++)
  { x = i * step;
    xray[i] = x; 
    for (j = 0; j < n; j++)
    { y = j * step;
      yray[j] = y;
      zmat[i][j] = (x * x - 1.) * (x * x - 1.) +
                   (y * y - 1.) * (y * y - 1.);
    }
  }
    
  setpag ("da4p");
  metafl ("cons");
  disini ();
  hwfont ();
  pagera ();

  mixalf ();
  titlin ("Shaded Contour Plot", 1);
  titlin ("F(X,Y) = (X[2$ - 1)[2$ + (Y[2$ - 1)[2$", 3);
  name ("X-axis", "x");
  name ("Y-axis", "y");

  shdmod ("poly", "contur");
  axspos (450, 2670);
  graf (0.0f, 1.6f, 0.0f, 0.2f, 0.0f, 1.6f, 0.0f, 0.2f);

  for (i = 1; i <= 12; i++)
    zlev[12-i] = 0.1 + (i - 1) * 0.1;

  conshd (cast (float *) xray, n, cast (float *) yray, n, 
          cast (float *) zmat, cast (float *) zlev, 12);

  height(50);
  title();
  disfin ();
}
