11.122 Sample ‘surf3

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.

MGL code:

call 'prepare3d'
light on:alpha on
subplot 2 2 0:title 'Surf3 plot (default)'
rotate 50 60:box:surf3 c
subplot 2 2 1:title '"\#" style'
rotate 50 60:box:surf3 c '#'
subplot 2 2 2:title '"." style'
rotate 50 60:box:surf3 c '.'

C++ code:

void smgl_surf3(mglGraph *gr)
{
	mglData c;	mgls_prepare3d(&c);
	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Surf3 plot (default)");	}
	gr->Rotate(50,60);	gr->Light(true);	gr->Alpha(true);
	gr->Box();	gr->Surf3(c);
	if(big==3)	return;
	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,".");
}
Sample surf3