import std.math;
import Dislin;

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

  step = 360.f / (n-1);
  fpi = 3.1415926/180;

  for (i = 0; i < n; i++)
  { x = i * step;
    for (j = 0; j < n; j++)
    { y = j * step;
      zmat[i][j] = 2 * sin (x * fpi) * sin (y * fpi);
    }
  }
    
  setpag ("da4p");
  metafl ("cons");
  disini ();
  hwfont ();
  pagera ();

  titlin ("3-D Colour Plot of the Function", 2);
  titlin ("F(X,Y) = 2 * SIN(X) * SIN(Y)", 4);

  axspos (200, 2600);
  axslen (1800, 1800);

  name ("X-axis", "x");
  name ("Y-axis", "y");
  name ("Z-axis", "z");

  view3d (-5.f, -5.f, 4.f,"abs");
  graf3d (0.f,360.f,0.f,90.f,0.f,360.f,0.f,90.f,-3.f,3.f,-3.f,1.f);
  height (50);
  title ();

  color ("green");
  surmat(cast (float *) zmat, 50, 50, 1, 1);
  disfin ();
}
