11.139 Sample ‘torus

Function torus draw surface of the curve rotation.

MGL code:

call 'prepare1d'
subplot 2 2 0:title 'Torus plot (default)':light on:rotate 50 60:box:torus y1 y2
subplot 2 2 1:title '"x" style':light on:rotate 50 60:box:torus y1 y2 'x'
subplot 2 2 2:title '"z" style':light on:rotate 50 60:box:torus y1 y2 'z'
subplot 2 2 3:title '"\#" style':light on:rotate 50 60:box:torus y1 y2 '#'

C++ code:

void smgl_torus(mglGraph *gr)
{
	mglData y1,y2;	mgls_prepare1d(0,&y1,&y2);
	if(big!=3)	{	gr->SubPlot(2,2,0);	gr->Title("Torus plot (default)");	}
	gr->Light(true);	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2);
	if(big==3)	return;
	gr->SubPlot(2,2,1);	gr->Title("'x' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"x");
	gr->SubPlot(2,2,2);	gr->Title("'z' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"z");
	gr->SubPlot(2,2,3);	gr->Title("'\\#' style");	gr->Rotate(50,60);	gr->Box();	gr->Torus(y1,y2,"#");
}

Sample torus