11.89 Sample ‘paramv

Example of parametric plots for vector fields.

MGL code:

new x 20 20 20 '(x+2)/3*sin(pi*y/2)'
new y 20 20 20 '(x+2)/3*cos(pi*y/2)'
new z 20 20 20 'z+x'
new ex 20 20 20 'x'
new ey 20 20 20 'x^2+y'
new ez 20 20 20 'y^2+z'

new x1 50 50 '(x+2)/3*sin(pi*y/2)'
new y1 50 50 '(x+2)/3*cos(pi*y/2)'
new e1 50 50 'x'
new e2 50 50 'x^2+y'

subplot 3 3 0:rotate 40 60:box:vect x1 y1 e1 e2
subplot 3 3 1:rotate 40 60:box:flow x1 y1 e1 e2
subplot 3 3 2:rotate 40 60:box:pipe x1 y1 e1 e2
subplot 3 3 3:rotate 40 60:box:dew x1 y1 e1 e2
subplot 3 3 4:rotate 40 60:box:vect x y z ex ey ez
subplot 3 3 5:rotate 40 60:box
vect3 x y z ex ey ez:vect3 x y z ex ey ez 'x':vect3 x y z ex ey ez 'z'
grid3 x y z z '{r9}':grid3 x y z z '{g9}x':grid3 x y z z '{b9}z'
subplot 3 3 6:rotate 40 60:box:flow x y z ex ey ez
subplot 3 3 7:rotate 40 60:box:pipe x y z ex ey ez

C++ code:

void smgl_paramv(mglGraph *gr)	// parametric plots for vector field
{
	mglData x(20,20,20), y(20,20,20), z(20,20,20), ex(20,20,20), ey(20,20,20), ez(20,20,20);
	gr->Fill(x,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y,"(x+2)/3*cos(pi*y/2)");	gr->Fill(z,"x+z");
	gr->Fill(ex,"x");	gr->Fill(ey,"x^2+y");	gr->Fill(ez,"y^2+z");
	mglData x1(20,20), y1(20,20), e1(20,20), e2(20,20);
	gr->Fill(x1,"(x+2)/3*sin(pi*y/2)");	gr->Fill(y1,"(x+2)/3*cos(pi*y/2)");
	gr->Fill(e1,"x");	gr->Fill(e2,"x^2+y");

	gr->SubPlot(3,3,0);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x1,y1,e1,e2);
	gr->SubPlot(3,3,1);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x1,y1,e1,e2);
	gr->SubPlot(3,3,2);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x1,y1,e1,e2);
	gr->SubPlot(3,3,3);	gr->Rotate(40,60);	gr->Box();	gr->Dew(x1,y1,e1,e2);
	gr->SubPlot(3,3,4);	gr->Rotate(40,60);	gr->Box();	gr->Vect(x,y,z,ex,ey,ez);
	gr->SubPlot(3,3,5);	gr->Rotate(40,60);	gr->Box();
	gr->Vect3(x,y,z,ex,ey,ez);	gr->Vect3(x,y,z,ex,ey,ez,"x");	gr->Vect3(x,y,z,ex,ey,ez,"z");
	gr->Grid3(x,y,z,z,"{r9}");	gr->Grid3(x,y,z,z,"{g9}x");		gr->Grid3(x,y,z,z,"{b9}z");
	gr->SubPlot(3,3,6);	gr->Rotate(40,60);	gr->Box();	gr->Flow(x,y,z,ex,ey,ez);
	gr->SubPlot(3,3,7);	gr->Rotate(40,60);	gr->Box();	gr->Pipe(x,y,z,ex,ey,ez);
}
Sample paramv