[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.5.2 2D plot sample
C++ code
gr->Light(true); mglData a0(50,40); a0.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->SubPlot(2,2,0); gr->Rotate(60,40); gr->Surf(a0); gr->Box(); mglData x(50,40),y(50,40),z(50,40); x.Modify("0.8*sin(2*pi*x)*sin(pi*y)"); y.Modify("0.8*cos(2*pi*x)*sin(pi*y)"); z.Modify("0.8*cos(pi*y)"); gr->SubPlot(2,2,1); gr->Rotate(60,40); gr->Surf(x,y,z,"BbwrR"); gr->Box(); mglData a1(50,40,3); a1.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*sin(3*pi*(x*y))",1); a1.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",2); gr->SubPlot(2,2,2); gr->Rotate(60,40); gr->Alpha(true); gr->Surf(a1); gr->Box(); gr->SubPlot(2,2,3); gr->Rotate(60,40); gr->Dens(a1); gr->Box();
MGL code
light on new a0 50 40 modify a0 '0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))' subplot 2 2 0:rotate 60 40 surf a0: box new x 50 40: new y 50 40: new z 50 40 modify x '0.8*sin(2*pi*x)*sin(pi*y)' modify y '0.8*cos(2*pi*x)*sin(pi*y)' modify z '0.8*cos(pi*y)' subplot 2 2 1:rotate 60 40 surf x y z 'bbwrr': box new a1 50 40 3 modify a1 '0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))' modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*sin(3*pi*(x*y))' 1 modify a1 '0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))' 2 subplot 2 2 2:rotate 60 40 alpha on surf a1: box subplot 2 2 3: rotate 60 40 dens a1: box