11.35 Sample ‘cut

Example of point cutting (cut.

MGL code:

call 'prepare2d'
call 'prepare3d'
subplot 2 2 0:title 'Cut on (default)':rotate 50 60:light on:box:surf a; zrange -1 0.5
subplot 2 2 1:title 'Cut off':rotate 50 60:box:surf a; zrange -1 0.5; cut off
subplot 2 2 2:title 'Cut in box':rotate 50 60:box:alpha on
cut 0 -1 -1 1 0 1.1:surf3 c
cut 0 0 0 0 0 0	# restore back
subplot 2 2 3:title 'Cut by formula':rotate 50 60:box
cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)':surf3 c

C++ code:

void smgl_cut(mglGraph *gr)	// cutting
{
	mglData a,c,v(1);	mgls_prepare2d(&a);	mgls_prepare3d(&c);	v.a[0]=0.5;
	gr->SubPlot(2,2,0);	gr->Title("Cut on (default)");	gr->Rotate(50,60);	gr->Light(true);
	gr->Box();	gr->Surf(a,"","zrange -1 0.5");
	gr->SubPlot(2,2,1);	gr->Title("Cut off");		gr->Rotate(50,60);
	gr->Box();	gr->Surf(a,"","zrange -1 0.5; cut off");
	gr->SubPlot(2,2,2);	gr->Title("Cut in box");	gr->Rotate(50,60);
	gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
	gr->Alpha(true);	gr->Box();	gr->Surf3(c);
	gr->SetCutBox(mglPoint(0), mglPoint(0));	// switch it off
	gr->SubPlot(2,2,3);	gr->Title("Cut by formula");	gr->Rotate(50,60);
	gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
	gr->Box();	gr->Surf3(c);	gr->CutOff("");	// switch it off
}
Sample cut