Sometimes, one have only unregular data, like as data on triangular grids, or experimental results and so on. Such kind of data cannot be used as simple as regular data (like matrices). Only few functions, like dots, can handle unregular data as is.
However, one can use built in triangulation functions for interpolating unregular data points to a regular data grids. There are 2 ways. First way, one can use triangulation function to obtain list of vertexes for triangles. Later this list can be used in functions like triplot or tricont. Second way consist in usage of datagrid function, which fill regular data grid by interpolated values, assuming that coordinates of the data grid is equidistantly distributed in axis range. Note, you can use options (see Опции команд) to change default axis range as well as in other plotting functions.
int sample(mglGraph *gr) { mglData x(100), y(100), z(100); gr->Fill(x,"2*rnd-1"); gr->Fill(y,"2*rnd-1"); gr->Fill(z,"v^2-w^2",x,y); // first way - plot triangular surface for points mglData d = mglTriangulation(x,y); gr->Title("Triangulation"); gr->Rotate(40,60); gr->Box(); gr->Light(true); gr->TriPlot(d,x,y,z); gr->TriPlot(d,x,y,z,"#k"); // second way - make regular data and plot it mglData g(30,30); gr->DataGrid(g,x,y,z); gr->Mesh(g,"m"); }