title: Plot a simple ILNumerics surface specified by X, Y, Z coordinates?
body: <p>I want to draw an ILNumerics 3D surface by specifying the corners of the surface. In the code below I call these corners point0, point1, point2, and point3. The code below doesn't work and  I don't know why. Also, I don't understand why I need convert my X, Y and Z-data into matrices, but in all the examples I could find they did something similar. Please help me.</p>
  
  <pre><code>    private void ilPanel1_Load(object sender, EventArgs e)
      {
          ILPlotCube pc = new ILPlotCube(twoDMode: false);
          ILScene scene = new ILScene { pc };
  
          ILArray&lt;float&gt; point0 = new float[] { 0, 0.5f, 1 };
          ILArray&lt;float&gt; point1 = new float[] { 0, 1, 1 };
          ILArray&lt;float&gt; point2 = new float[] { 0, 0.75f, 0.75f };
          ILArray&lt;float&gt; point3 = new float[] { 0, 1, 0.5f };
  
          ILArray&lt;float&gt; X = new float[] { (float)point0[0], (float)point1[0], (float)point2[0], (float)point3[0] };
          ILArray&lt;float&gt; Y = new float[] { (float)point0[1], (float)point1[1], (float)point2[1], (float)point3[1] };
          ILArray&lt;float&gt; Z = new float[] { (float)point0[2], (float)point1[2], (float)point2[2], (float)point3[2] };
  
  
          // compute X and Y pointinates for every grid point
          ILArray&lt;float&gt; YMat = 1; // provide YMat as output to meshgrid
          ILArray&lt;float&gt; XMat = ILMath.meshgrid(X, Y, YMat); // only need mesh for 2D function here
          ILArray&lt;float&gt; ZMat = ILMath.zeros&lt;float&gt;(Y.Length, X.Length);
          ZMat["0;:"] = Z;
          ZMat["1;:"] = Z;
          ZMat["2;:"] = Z;
          ZMat["3;:"] = Z;
  
          // preallocate data array for ILSurface: X by Y by 3
          // Note the order: 3 matrix slices of X by Y each, for Z,X,Y pointinates of every grid point
          ILArray&lt;float&gt; XYZ = ILMath.zeros&lt;float&gt;(Y.Length, X.Length, 3);
  
  
          XYZ[":;:;0"] = ZMat;
          XYZ[":;:;1"] = XMat; // X pointinates for every grid point
          XYZ[":;:;2"] = YMat; // Y pointinates for every grid point
  
  
          pc.Add(new ILSurface(XYZ));
  
          ilPanel1.Scene = scene;
          ilPanel1.Scene.First&lt;ILPlotCube&gt;().Rotation = Matrix4.Rotation(new Vector3(1f, 0.23f, 1f), 0.7f);
      }
  </code></pre>