Next: , Up: 3D samples   [Contents][Index]


3.7.1 Surf3 sample

Function surf3 is one of most suitable (for my opinion) functions to visualize 3D data. It draw the isosurface(s) – surface(s) of constant amplitude (3D analogue of contour lines). You can draw wired isosurfaces if specify ‘#’ style. The sample code is:

int sample(mglGraph *gr)
{
  mglData c;  mgls_prepare3d(&c);
  gr->Light(true);    gr->Alpha(true);
  gr->SubPlot(2,2,0); gr->Title("Surf3 plot (default)");
  gr->Rotate(50,60);  gr->Box();  gr->Surf3(c);

  gr->SubPlot(2,2,1); gr->Title("'\\#' style");
  gr->Rotate(50,60);  gr->Box();  gr->Surf3(c,"#");

  gr->SubPlot(2,2,2); gr->Title("'.' style");
  gr->Rotate(50,60);  gr->Box();  gr->Surf3(c,".");
  return 0;
}
Example of Surf3()