[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter contain a lot of sample codes for all types of plots and for most important examples and hints. The same sample (with pictures) you can find at http://mathgl.sf.net/pictures.html. Most of examples have the sample code on 5 languages: C++, MGL, C, Fortran and Python. However, I put only C++ code for some of examples due to a lot of them and clearency how to write code for other languages. All samples are divided on 6 large categories.
The minimal code to view the samples for different languages are following.
C++ code
For compilation use: g++ -o sample sample.cpp -lmgl
.
#include <mgl/mgl_zb.h> int main() { mglGraph *gr = new mglGraphZB; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // put sample code here //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gr->ShowImage(); delete gr; return 0; }
MGL code
For preview use: mglview sample.mgl
.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # put sample code here # --> you may use sample as is :) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pure C code
For compilation use: gcc -o sample sample.c -lmgl
.
#include <mgl/mgl_c.h> int main() { HMGL gr = mgl_create_graph_zb(600,400); /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* put sample code here */ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ mgl_show_image(gr,"",0); mgl_delete_graph(gr); return 0; }
Fortran code
For compilation use: gfortran -o sample sample.f90 -lmgl
. Note, fortran don't have argument checking. So you have to take special attention to pass real variables to real arguments of functions and integer variables to integer arguments of functions. There is no other special checking for that!!!
integer gr, mgl_create_graph_zb gr = mgl_create_graph_zb(600,400) !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! put sample code here !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ call mgl_show_image(gr,'',0) call mgl_delete_graph(gr) end
Python
For preview use: python sample.py
.
from mathgl import * gr = mglGraph(); #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # put sample code here #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gr.ShowImage();
9.1 1D plotting samples | ||
9.2 2D plotting samples | ||
9.3 3D plotting samples | ||
9.4 Dual plotting samples | ||
9.5 Additional features | ||
9.6 Advanced features |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Plot. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Box(); gr->Plot(y);
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 box plot y
Pure C code
HMDT y = mgl_create_data_size(50,3,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_box(gr,1); mgl_plot(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,3,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_box(gr,1) call mgl_plot(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.Box(); gr.Plot(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Plot. 3D pdf
C++ code
mglData y(10,3); y.Modify("0.4*sin(pi*(2*x+y/2))+0.1*rnd"); gr->Radar(y,"#");
MGL code
new y 10 3 modify y '0.4*sin(pi*(2*x+y/2))+0.1*rnd' radar y '#'
Pure C code
HMDT y = mgl_create_data_size(10,3,1); mgl_data_modify(y,"0.4*sin(pi*(2*x+y/2))+0.1*rnd",0); mgl_radar(gr,y,"#",-1); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(10,3,1) call mgl_data_modify(y,'0.4*sin(pi*(2*x+y/2))+0.1*rnd',0) call mgl_radar(gr,y,'#',-1.) call mgl_delete_data(y)
Python
y = mglData(10,3); y.Modify("0.4*sin(pi*(2*x+y/2))+0.1*rnd"); gr.Radar(y,"#");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Tens. 3D pdf
C++ code
mglData y(50), c(50); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)"); c.Modify("sin(2*pi*x)"); gr->Box(); gr->Tens(y,c);
MGL code
new y 50 new c 50 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify c 'sin(2*pi*x)' box tens y c
Pure C code
HMDT y = mgl_create_data_size(50,1,1); HMDT c = mgl_create_data_size(50,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(c,"sin(2*pi*x)",0); mgl_box(gr,1); mgl_tens(gr,y,c,NULL); mgl_delete_data(y); mgl_delete_data(c);
Fortran code
integer y, c, mgl_create_data_size y = mgl_create_data_size(50,1,1) c = mgl_create_data_size(50,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(c,'sin(2*pi*x)',0) call mgl_box(gr,1) call mgl_tens(gr,y,'') call mgl_delete_data(y) call mgl_delete_data(c)
Python
y = mglData(50); c = mglData(50); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)"); c.Modify("sin(2*pi*x)"); gr.Box(); gr.Tens(y,c);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Area. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Org=mglPoint(0,0); gr->Box(); gr->Area(y);
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 origin 0 0 box area y
Pure C code
HMDT y = mgl_create_data_size(50,3,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_area(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,3,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_set_origin(gr,0.,0.,0.) call mgl_box(gr,1) call mgl_area(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.SetOrigin(0.,0.); gr.Box(); gr.Area(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Bars. 3D pdf
C++ code
mglData y(10,3); y.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd"); gr->Org=mglPoint(0,0); gr->Box(); gr->Bars(y);
MGL code
new y 10 3 modify y '0.8*sin(pi*(2*x+y/2))+0.2*rnd' origin 0 0 box bars y
Pure C code
HMDT y = mgl_create_data_size(10,3,1); mgl_data_modify(y,"0.8*sin(pi*(2*x+y/2))+0.2*rnd"); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_bars(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(10,3,1) call mgl_data_modify(y,'0.8*sin(pi*(2*x+y/2))+0.2*rnd') call mgl_set_origin(gr,0.,0.,0.) call mgl_box(gr,1) call mgl_bars(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(10,3); y.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd"); gr.SetOrigin(0.,0.); gr.Box(); gr.Bars(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Barh. 3D pdf
C++ code
mglData y(10,3); y.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd"); gr->Org=mglPoint(0,0); gr->Box(); gr->Barh(y);
MGL code
new y 10 3 modify y '0.8*sin(pi*(2*x+y/2))+0.2*rnd' origin 0 0 box barh y
Pure C code
HMDT y = mgl_create_data_size(10,3,1); mgl_data_modify(y,"0.8*sin(pi*(2*x+y/2))+0.2*rnd"); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_barh(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(10,3,1) call mgl_data_modify(y,'0.8*sin(pi*(2*x+y/2))+0.2*rnd') call mgl_set_origin(gr,0.,0.,0.) call mgl_box(gr,1) call mgl_barh(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(10,3); y.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd"); gr.SetOrigin(0.,0.); gr.Box(); gr.Barh(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Step. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Box(); gr->Step(y);
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 box step y
Pure C code
HMDT y = mgl_create_data_size(50,3,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_box(gr,1); mgl_step(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,3,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_box(gr,1) call mgl_step(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.Box(); gr.Step(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Stem. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Org=mglPoint(0,0); gr->Box(); gr->Stem(y);
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 origin 0 0 box stem y
Pure C code
HMDT y = mgl_create_data_size(50,3,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_stem(gr,y,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,3,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_set_origin(gr,0.,0.,0.) call mgl_box(gr,1) call mgl_stem(gr,y,'') call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.SetOrigin(0.,0.); gr.Box(); gr.Stem(y);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Region. 3D pdf
C++ code
mglData y1(50), y2(50); y1.Modify("0.3*sin(2*pi*x)"); y2.Modify("0.5+0.3*cos(2*pi*x)"); gr->Box(); gr->Region(y1,y2,"r"); gr->Plot(y1,"k2"); gr->Plot(y2,"k2");
MGL code
new y1 50 new y2 50 modify y1 '0.3*sin(2*pi*x)' modify y2 '0.5+0.3*cos(2*pi*x)' box region y1 y2 'r' plot y1 'k2' plot y2 'k2'
Pure C code
HMDT y1 = mgl_create_data_size(50,1,1); HMDT y2 = mgl_create_data_size(50,1,1); mgl_data_modify(y1,"0.3*sin(2*pi*x)",0); mgl_data_modify(y2,"0.5+0.3*cos(2*pi*x)",0); mgl_box(gr,1); mgl_region(gr,y1,y2,"r",1); mgl_plot(gr,y1,"k2"); mgl_plot(gr,y2,"k2"); mgl_delete_data(y1); mgl_delete_data(y2);
Fortran code
integer y1, y2, mgl_create_data_size y1 = mgl_create_data_size(50,1,1); y2 = mgl_create_data_size(50,1,1); call mgl_data_modify(y1,'0.3*sin(2*pi*x)',0); call mgl_data_modify(y2,'0.5+0.3*cos(2*pi*x)',0); call mgl_box(gr,1); call mgl_region(gr,y1,y2,'r',1); call mgl_plot(gr,y1,'k2'); call mgl_plot(gr,y2,'k2'); call mgl_delete_data(y1); call mgl_delete_data(y2);
Python
y1, y2, x = mglData(50), mglData(50), mglData(50); y1.Modify("0.3*sin(2*pi*x)"); y2.Modify("0.5+0.3*cos(2*pi*x)"); gr.Box(); gr.Region(y1,y2,"r"); gr.Plot(y1,"k2"); gr.Plot(y2,"k2");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Error. 3D pdf
C++ code
mglData y(50,1), x0(10), y0(10), ex(10), ey(10); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); x0.Modify("2*x-1 + 0.1*rnd-0.05"); y0.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1"); ey.Modify("0.2"); ex.Modify("0.1"); gr->Box(); gr->Plot(y); gr->Error(x0,y0,ex,ey,"ko");
MGL code
new y 50 new x0 10 new y0 10 new ex 10 new ey 10 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify x0 '2*x-1 + 0.1*rnd-0.05' modify y0 '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1' modify ey '0.2' modify ex '0.1' box plot y error x0 y0 ex ey 'ko'
Pure C code
HMDT y = mgl_create_data_size(50,1,1); HMDT x0 = mgl_create_data_size(10,1,1); HMDT y0 = mgl_create_data_size(10,1,1); HMDT ex = mgl_create_data_size(10,1,1); HMDT ey = mgl_create_data_size(10,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(x0,"2*x-1 + 0.1*rnd-0.05",0); mgl_data_modify(y0,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1",0); mgl_data_modify(ey,"0.2",0); mgl_data_modify(ex,"0.1",0); mgl_box(gr,1); mgl_plot(gr,y,NULL); mgl_error_exy(gr,x0,y0,ex,ey,"ko"); mgl_delete_data(x0); mgl_delete_data(y0); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(y);
Fortran code
integer y, x0, y0, ex, ey, mgl_create_data_size y = mgl_create_data_size(50,3,1) x0 = mgl_create_data_size(10,1,1) y0 = mgl_create_data_size(10,1,1) ex = mgl_create_data_size(10,1,1) ey = mgl_create_data_size(10,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(x0,'2*x-1 + 0.1*rnd-0.05',0); call mgl_data_modify(y0,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + & 0.2*sin(pi*x) + 0.2*rnd-0.1',0); call mgl_data_modify(ey,'0.2',0) call mgl_data_modify(ex,'0.1',0); call mgl_box(gr,1) call mgl_plot(gr,y,'') call mgl_error_exy(gr,x0,y0,ex,ey,'ko') call mgl_delete_data(x0) call mgl_delete_data(y0) call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(y)
Python
y, x0, y0, ex, ey = mglData(50,1), mglData(10), mglData(10), mglData(10), mglData(10); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); x0.Modify("2*x-1+0.1*rnd-0.05"); y0.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)+0.2*rnd-0.1"); ey.Modify("0.2"); ex.Modify("0.1"); gr.Box(); gr.Plot(y); gr.Error(x0,y0,ex,ey,"ko");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of BoxPlot. 3D pdf
C++ code
mglData a(10,7); a.Modify("(2*rnd-1)^3/2"); gr->Box(); gr->BoxPlot(a); gr->Plot(a," ko");
MGL code
new a 10 7 modify a '(2*rnd-1)^3/2' box boxplot a plot a ' ko'
Pure C code
HMDT a = mgl_create_data_size(10,7,1); mgl_data_modify(a,"(2*rnd-1)^3/2",0); mgl_box(gr,1); mgl_plot(gr,a," ko"); mgl_boxplot(gr,a,NULL); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size y = mgl_create_data_size(10,7,1) call mgl_data_modify(a,'(2*rnd-1)^3/2',0); call mgl_box(gr,1) call mgl_plot(gr,a,' ko') call mgl_boxplot(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(10,7); a.Modify("(2*rnd-1)^3/2"); gr.Box(); gr.Plot(a," ko"); gr.BoxPlot(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Mark. 3D pdf
C++ code
mglData y(50,3), y1(50); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); gr->Box(); gr->Mark(y,y1,"bs");
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 new y1 50 modify y1 '0.5+0.3*cos(2*pi*x)' box mark y y1 'bs'
Pure C code
HMDT y = mgl_create_data_size(50,3,1); HMDT y1 = mgl_create_data_size(50,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_data_modify(y1,"0.5+0.3*cos(2*pi*x)",0); mgl_box(gr,1); mgl_mark_y(gr,y,y1,"bs"); mgl_delete_data(y); mgl_delete_data(y1);
Fortran code
integer y, y1, mgl_create_data_size y = mgl_create_data_size(50,3,1) y1 = mgl_create_data_size(50,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_data_modify(y1,'0.5+0.3*cos(2*pi*x)',0) call mgl_box(gr,1) call mgl_mark_y(gr,y,y1,'bs') call mgl_delete_data(y) call mgl_delete_data(y1)
Python
y, y1 = mglData(50,3), mglData(50); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); gr.Box(); gr.Mark(y,y1,"bs");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of TextMark. 3D pdf
C++ code
mglData y(50,3), y1(50); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); gr->Box(); gr->TextMark(y,y1,"\\gamma");
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 new y1 50 modify y1 '0.5+0.3*cos(2*pi*x)' box textmark y y1 '\gamma'
Pure C code
HMDT y, y1; y = mgl_create_data_size(50,3,1); y1 = mgl_create_data_size(50,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_data_modify(y1,"0.5+0.3*cos(2*pi*x)",0); mgl_box(gr,1); mgl_textmark_yr(gr,y,y1,"\\gamma",""); mgl_delete_data(y); mgl_delete_data(y1);
Fortran code
integer y, y1, mgl_create_data_size y = mgl_create_data_size(50,3,1) y1 = mgl_create_data_size(50,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_data_modify(y1,'0.5+0.3*cos(2*pi*x)',0) call mgl_box(gr,1) call mgl_textmark_yr(gr,y,y1,'\gamma','') call mgl_delete_data(y) call mgl_delete_data(y1)
Python
y, y1 = mglData(50,3), mglData(50); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); gr.Box(); gr.TextMark(y,y1,"\\gamma");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Tube. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Tube(y,0.05);
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 rotate 40 60 light on box tube y 0.05
Pure C code
HMDT y = mgl_create_data_size(50,3,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_tube(gr,y,0.05,NULL); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,3,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_tube(gr,y,0.05,'') call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Tube(y,0.05);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Text. 3D pdf
C++ code
mglData y(50,3); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr->Box(); gr->Plot(y.SubData(-1,0)); gr->Text(y,"This is very long string drawn along a curve",":k"); gr->Text(y,"Another string drawn above a curve","T:r");
MGL code
new y 50 3 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 box plot y(:,0) text y 'This is very long string drawn along a curve' ':k' text y 'Another string drawn above a curve' 'T:r'
Pure C code
HMDT y = mgl_create_data_size(50,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_box(gr,1); mgl_plot(gr,y,NULL); mgl_text_y(gr,y,"This is very long string drawn along a curve",":k",-1.); mgl_text_y(gr,y,"Another string drawn above a curve","T:r",-1.); mgl_delete_data(y);
Fortran code
integer y, mgl_create_data_size y = mgl_create_data_size(50,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_box(gr,1) call mgl_plot(gr,y,'') call mgl_text_y(gr,y,'This is very long string drawn along a curve',':k',-1.) call mgl_text_y(gr,y,'Another string drawn above a curve','T:r',-1.) call mgl_delete_data(y)
Python
y = mglData(50,3); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); gr.Box(); gr.Plot(y.SubData(-1,0)); gr.Text(y,"This is very long string drawn along a curve",":k"); gr.Text(y,"Another string drawn above a curve","T:r");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Torus. 3D pdf
C++ code
mglData y1(50), y2(50); y1.Modify("0.5+0.3*cos(2*pi*x)"); y2.Modify("0.3*sin(2*pi*x)"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Torus(y1,y2,"pz");
MGL code
new y1 50 new y2 50 modify y1 '0.5+0.3*cos(2*pi*x)' modify y2 '0.3*sin(2*pi*x)' rotate 40 60 light on box torus y1 y2 'pz'
Pure C code
HMDT y1 = mgl_create_data_size(50,1,1); HMDT y2 = mgl_create_data_size(50,1,1); mgl_data_modify(y1,"0.5+0.3*cos(2*pi*x)",0); mgl_data_modify(y2,"0.3*sin(2*pi*x)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_torus(gr,y1,y2,"pz"); mgl_delete_data(y1); mgl_delete_data(y2);
Fortran code
integer y1, y2, mgl_create_data_size y1 = mgl_create_data_size(50,1,1); y2 = mgl_create_data_size(50,1,1); call mgl_data_modify(y1,"0.5+0.3*cos(2*pi*x)",0); call mgl_data_modify(y2,"0.3*sin(2*pi*x)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_torus(gr,y1,y2,'pz') call mgl_delete_data(y1) call mgl_delete_data(y2)
Python
y1, y2 = mglData(50), mglData(50); y1.Modify("0.5+0.3*cos(2*pi*x)"); y2.Modify("0.3*sin(2*pi*x)"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Torus(y1,y2,"pz");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Chart. 3D pdf
C++ code
mglData ch(7,2); ch.Modify("rnd+0.1"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Chart(ch,"#");
MGL code
new ch 7 2 modify ch 'rnd+0.1' rotate 40 60 light on box chart ch
Pure C code
HMDT ch = mgl_create_data_size(7,2,1); mgl_data_modify(ch,"rnd+0.1",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_chart(gr,ch,"#"); mgl_delete_data(ch);
Fortran code
integer ch, mgl_create_data_size ch = mgl_create_data_size(7,2,1) call mgl_data_modify(ch,'rnd+0.1',0) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_chart(gr,ch,'#') call mgl_delete_data(ch)
Python
ch = mglData(7,2); ch.Modify("rnd+0.1"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Chart(ch,"#");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Chart in cylindrical coordinates. 3D pdf
C++ code
mglData ch(7,2); ch.Modify("rnd+0.1"); gr->Rotate(40,60); gr->Light(true); gr->Axis("(y+1)/2*cos(pi*x)","(y+1)/2*sin(pi*x)",0); gr->Box(); gr->Chart(ch,"bgr cmy#");
MGL code
new ch 7 2 modify ch 'rnd+0.1' rotate 40 60 light on axis '(y+1)/2*cos(pi*x)' '(y+1)/2*sin(pi*x)' '' box chart ch 'bgr cmy#'
Pure C code
HMDT ch = mgl_create_data_size(7,2,1); mgl_data_modify(ch,"rnd+0.1",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_func(gr,"(y+1)/2*cos(pi*x)","(y+1)/2*sin(pi*x)",0); mgl_box(gr,1); mgl_chart(gr,ch,"bgr cmy#"); mgl_delete_data(ch);
Fortran code
integer ch, mgl_create_data_size ch = mgl_create_data_size(7,2,1) call mgl_data_modify(ch,'rnd+0.1',0) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_func(gr,'(y+1)/2*cos(pi*x)','(y+1)/2*sin(pi*x)',''); call mgl_box(gr,1) call mgl_chart(gr,ch,'bgr cmy#') call mgl_delete_data(ch)
Python
ch = mglData(7,2); ch.Modify("rnd+0.1"); gr.Rotate(40,60); gr.Light(True); gr.SetFunc("(y+1)/2*cos(pi*x)","(y+1)/2*sin(pi*x)"); gr.Box(); gr.Chart(ch,"bgr cmy#");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Surf(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box surf a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_surf(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_surf(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Surf(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf & Alpha. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->Surf(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on alpha on box surf a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_surf(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_surf(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Alpha(True); gr.Surf(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf & Fog. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Fog(1); gr->Box(); gr->Surf(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on fog 1 box surf a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_fog(gr,1.,0.25); mgl_box(gr,1); mgl_surf(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_fog(gr,1.,0.25) call mgl_box(gr,1) call mgl_surf(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Fog(1); gr.Surf(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of sharp color scheme. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Surf(a,"BbcyrR|");
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box surf a 'BbcyrR|'
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_surf(gr,a,"BbcyrR|"); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_surf(gr,a,'BbcyrR|') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Surf(a,"BbcyrR|");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Mesh. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Box(); gr->Mesh(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 box mesh a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_mesh(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_mesh(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Mesh(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Fall. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Box(); gr->Fall(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 box fall a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_fall(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_fall(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Fall(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Belt. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Belt(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box belt a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_belt(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_belt(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Belt(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Tile. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Tile(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box tile a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_tile(gr,a,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_tile(gr,a,'') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Tile(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Boxs. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Org = mglPoint(0,0,0); gr->Box(); gr->Boxs(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on origin 0 0 0 box boxs a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_boxs(gr,a,0,0.); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_origin(gr,0.,0.,0.); call mgl_box(gr,1) call mgl_boxs(gr,a,'',0.) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.SetOrigin(0.,0.,0.); gr.Box(); gr.Boxs(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Dens & Colorbar. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->Dens(a); gr->Colorbar();
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' box dens a colorbar
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_dens(gr,a,0,0); mgl_colorbar(gr,"",0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_dens(gr,a,'',0) call mgl_colorbar(gr,'',0) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.Dens(a); gr.Colorbar();
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Cont. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Box(); gr->Cont(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 box cont a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_cont(gr,a,0,7,NAN); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size real zero, nan ! I don't know the NaN symbol in Fortran. So I produce it as zero/zero zero = 0; nan = zero/zero a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_cont(gr,a,'',7,nan) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Box(); gr.Cont(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of ContF. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->ContF(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box contf a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_contf(gr,a,0,7,NAN); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size real zero, nan ! I don't know the NaN symbol in Fortran. So I produce it as zero/zero zero = 0; nan = zero/zero a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_contf(gr,a,'',7,nan) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.ContF(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of ContD. 3D pdf
C++ code
mglData a(50,40), v(9); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); v.Fill(-1,1); gr->Box(); gr->ContD(v,a); gr->Colorbar(v);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' var v 9 -1 1 box contd v a colorbar v
Pure C code
HMDT a = mgl_create_data_size(50,40,1); HMDT v = mgl_create_data_size(9,1,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_fill(v,-1.,1.,'x'); mgl_box(gr,1); mgl_contd_val(gr,v,a,0,0); mgl_colorbar_val(gr,v,NULL,0); mgl_delete_data(a); mgl_delete_data(v);
Fortran code
integer a, v, mgl_create_data_size a = mgl_create_data_size(50,40,1); v = mgl_create_data_size(9,1,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_fill(v,-1.,1.,'x'); call mgl_box(gr,1) call mgl_contd_val(gr,v,a,'',0); call mgl_colorbar_val(gr,v,NULL,0); call mgl_delete_data(a) call mgl_delete_data(v)
Python
a, v = mglData(50,40), mglData(9); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); v.Fill(-1,1); gr.Box(); gr.ContD(v,a); gr.Colorbar(v);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Axial. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->Axial(a);
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on alpha on box axial a
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_axial(gr,a,"",3); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_axial(gr,a,'',3) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.Box(); gr.Axial(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->Surf3(a);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 light on alpha on box surf3 a
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_surf3(gr,a,0,3); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_surf3(gr,a,'',3) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.Box(); gr.Surf3(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Cloud. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Alpha(true); gr->Box(); gr->Cloud(a,"wyrRk");
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 alpha on box cloud a 'wyrRk'
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_cloud(gr,a,"wyrRk",1.); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_cloud(gr,a,'wyrRk',1.) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Alpha(True); gr.Box(); gr.Cloud(a,"wyrRk");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of CloudP. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Alpha(true); gr->Box(); gr->CloudP(a,"wyrRk");
MGL code
Not available.
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_cloudp(gr,a,"wyrRk",1.); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_cloudp(gr,a,'wyrRk',1.) call mgl_delete_data(a)
Python
Not available.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Dens3. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Alpha(true); gr->Org = mglPoint(0,0,0); gr->Box(); gr->DensA(a); gr->Axis();
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 alpha on origin 0 0 0 box densa a axis
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_alpha(gr,1); mgl_set_origin(gr,0.,0.,0.); mgl_box(gr,1); mgl_dens3_all(gr,a,0); mgl_axis(gr,"xyz"); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_alpha(gr,1) call mgl_set_origin(gr,0.,0.,0.); call mgl_box(gr,1) call mgl_dens3_all(gr,a,'') call mgl_axis(gr,"xyz") call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Alpha(True); gr.SetOrigin(0,0,0); gr.Box(); gr.Axis(); gr.DensA(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Cont3. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Box(); gr->ContA(a);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 box conta a
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_cont_all(gr,a,0,7); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_cont_all(gr,a,'',7) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Box(); gr.ContA(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of ContF3. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->ContFA(a);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 light on box contfa a
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_contf_all(gr,a,0,7); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_contf_all(gr,a,'',7) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.ContFA(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of projection by Cont[XYZ]. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Box(); gr->ContX(a.Sum("x"),"",-1); gr->ContY(a.Sum("y"),"",1); gr->ContZ(a.Sum("z"),"",-1);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 box sum s a 'x' contx s '' -1 sum s a 'y' conty s '' 1 sum s a 'z' contz s '' -1
Pure C code
HMDT a = mgl_create_data_size(60,50,40), s; mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); s=mgl_data_sum(a,"x"); mgl_cont_x(gr,s,0,-1.,7); mgl_delete_data(s); s=mgl_data_sum(a,"y"); mgl_cont_y(gr,s,0,1.,7); mgl_delete_data(s); s=mgl_data_sum(a,"z"); mgl_cont_z(gr,s,0,-1.,7); mgl_delete_data(s); mgl_delete_data(a);
Fortran code
integer a,s, mgl_create_data_size, mgl_data_sum a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) s=mgl_data_sum(a,'x') call mgl_cont_x(gr,s,'',-1.,7) call mgl_delete_data(s) s=mgl_data_sum(a,'y') call mgl_cont_y(gr,s,'',1.,7) call mgl_delete_data(s) s=mgl_data_sum(a,'z') call mgl_cont_z(gr,s,'',-1.,7) call mgl_delete_data(s) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Box(); gr.ContX(a.Sum("x"),"",-1); gr.ContY(a.Sum("y"),"",1); gr.ContZ(a.Sum("z"),"",-1);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of projection by Dens[XYZ]. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Box(); gr->DensX(a.Sum("x"),"",-1); gr->DensY(a.Sum("y"),"",1); gr->DensZ(a.Sum("z"),"",-1);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 box sum s a 'x' densx s '' -1 sum s a 'y' densy s '' 1 sum s a 'z' densz s '' -1
Pure C code
HMDT a, s; a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); s=mgl_data_sum(a,"x"); mgl_dens_x(gr,s,0,-1.); mgl_delete_data(s); s=mgl_data_sum(a,"y"); mgl_dens_y(gr,s,0,1.); mgl_delete_data(s); s=mgl_data_sum(a,"z"); mgl_dens_z(gr,s,0,-1.); mgl_delete_data(s); mgl_delete_data(a);
Fortran code
integer a,s, mgl_create_data_size, mgl_data_sum a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) s=mgl_data_sum(a,'x') call mgl_dens_x(gr,s,'',-1.) call mgl_delete_data(s) s=mgl_data_sum(a,'y') call mgl_dens_y(gr,s,'',1.) call mgl_delete_data(s) s=mgl_data_sum(a,'z') call mgl_dens_z(gr,s,'',-1.) call mgl_delete_data(s) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Box(); gr.DensX(a.Sum("x"),"",-1); gr.DensY(a.Sum("y"),"",1); gr.DensZ(a.Sum("z"),"",-1);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3 & CutMin, CutMax. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->CutMin = mglPoint(0,-1,-1); gr->CutMax = mglPoint(1,0,1); gr->Box(); gr->Surf3(a);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 light on alpha on cut 0 -1 -1 1 0 1 box surf3 a
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_set_cut_box(gr,0.,-1.,-1.,1.,0.,1.); mgl_box(gr,1); mgl_surf3(gr,a,0,3); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_set_cut_box(gr,0.,-1.,-1.,1.,0.,1.); call mgl_box(gr,1) call mgl_surf3(gr,a,'',3) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.SetCutBox(0,-1,-1,1,0,1); gr.Box(); gr.Surf3(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of “Isocaps”. 3D pdf
C++ code
mglData a(61,51,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Light(true); gr->CutMin = mglPoint(0,-1,-1); gr->CutMax = mglPoint(1,0,1.1); gr->Box(); gr->Surf3(-1,a); gr->ContF3(a,'x',-1); gr->ContF3(a,'y',-1); gr->ContF3(a,'z', 0); gr->ContF3(a,'z',39);
MGL code
new a 61 51 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 light on cut 0 -1 -1 1 0 1.1 box surf3 a -1 contf3 a 'x' -1 contf3 a 'y' -1 contf3 a 'z' 0 contf3 a 'z' 39
Pure C code
HMDT a = mgl_create_data_size(61,51,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_cut_box(gr,0.,-1.,-1.,1.,0.,1.1); mgl_box(gr,1); mgl_surf3_val(gr,-1.,a,0); mgl_contf3(gr,a,'x',-1, "", 7); mgl_contf3(gr,a,'y',-1, "", 7); mgl_contf3(gr,a,'z', 0, "", 7); mgl_contf3(gr,a,'z',39, "", 7); mgl_delete_data(a);
Fortran code
a = mgl_create_data_size(61,51,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_cut_box(gr,0.,-1.,-1.,1.,0.,1.1); call mgl_box(gr,1) call mgl_surf3_val(gr,-1.,a,'') call mgl_contf3(gr,a,'x',-1, '', 7); call mgl_contf3(gr,a,'y',-1, '', 7); call mgl_contf3(gr,a,'z', 0, '', 7); call mgl_contf3(gr,a,'z',39, '', 7); call mgl_delete_data(a)
Python
a = mglData(61,51,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Light(True); gr.SetCutBox(0,-1,-1,1,0,1.1); gr.Box(); gr.Surf3(-1,a); gr.ContF3(a,"x",-1); gr.ContF3(a,"y",-1); gr.ContF3(a,"z",0); gr.ContF3(a,"z",39);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3 & CutOff. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)"); gr->Box(); gr->Surf3(a);
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 light on alpha on cut '(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)' box surf3 a
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_set_cutoff(gr,"(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)"); mgl_box(gr,1); mgl_surf3(gr,a,0,3); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,'-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)',0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_set_cutoff(gr,'(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)') call mgl_box(gr,1) call mgl_surf3(gr,a,'',3) call mgl_delete_data(a)
Python
a = mglData(61,51,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)"); gr.Box(); gr.Surf3(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of SurfC. 3D pdf
C++ code
mglData a(50,40), b(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->SurfC(a,b);
MGL code
new a 50 40 new b 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box surfc a b
Pure C code
HMDT a = mgl_create_data_size(50,40,1); HMDT b = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_surfc(gr,a,b,0); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_surfc(gr,a,b,'') call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(50,40), mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.SurfC(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of SurfA. 3D pdf
C++ code
mglData a(50,40), b(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->SurfA(a,b);
MGL code
new a 50 40 new b 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on alpha on box surfa a b
Pure C code
HMDT a, b; a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_surfa(gr,a,b,0); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1); call mgl_box(gr,1) call mgl_surfa(gr,a,b,'') call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(50,40), mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.Box(); gr.SurfC(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of TileS. 3D pdf
C++ code
mglData a(50,40), b(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->TileS(a,b);
MGL code
new a 50 40 new b 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box tile a b
Pure C code
HMDT a, b; a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_tiles(gr,a,b,0); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_tiles(gr,a,b,'') call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(50,40), mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.TileS(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Map. 3D pdf
C++ code
mglData a(50, 40), b(50, 40); gr->Puts(mglPoint(0, 0), "\\to", "", -1.4); gr->Axis(mglPoint(-1,-1,-2),mglPoint(1,1,2)); gr->SubPlot(2, 1, 0); a.Fill("x", gr->Min, gr->Max); b.Fill("y", gr->Min, gr->Max); gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", "C", -2); gr->Box(); gr->Map(a, b, "brgk", 0, false); gr->SubPlot(2, 1, 1); a.Fill("(x^3+y^3)/2", gr->Min, gr->Max); b.Fill("(x-y)/2", gr->Min, gr->Max); gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2); gr->Box(); gr->Map(a, b, "brgk", 0, false);
MGL code
new a 50 40 new b 50 40 text 0 0 '\to' zrange -2 2 subplot 2 1 0 text 0 1.1 '\{x, y\}' '' -2 box fill a 'x' fill b 'y' map a b 'brgk' 0 0 subplot 2 1 1 text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2 box fill a '(x^3+y^3)/2' fill b '(x-y)/2' map a b 'brgk' 0 0
Pure C code
HMDT a = mgl_create_data_size(50,40,1); HMDT b = mgl_create_data_size(50,40,1); mgl_puts_ext(gr, 0.,0.,0., "\\to", "", -1.4, 't'); mgl_set_axis_3d(gr,-1.,-1.,-2.,1.,1.,2.); mgl_subplot(gr, 2, 1, 0); mgl_data_fill_eq(gr, a, "x", 0, 0); mgl_data_fill_eq(gr, b, "y", 0, 0); mgl_puts_ext(gr, 0.,1.1,0., "\\{x, y\\}", "C", -2., 't'); mgl_box(gr,1); mgl_map(gr, a, b, "brgk", 0, 0); mgl_subplot(gr, 2, 1, 1); mgl_data_fill_eq(gr, a, "(x^3+y^3)/2", 0, 0); mgl_data_fill_eq(gr, b, "(x-y)/2", 0, 0); mgl_puts_ext(gr, 0.,1.1,0., "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2., 't'); mgl_box(gr,1); mgl_map(gr, a, b, "brgk", 0, 0); mgl_box(gr,1); mgl_map(gr,a,b,0,0,1); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); call mgl_puts_ext(gr, 0.,0.,0., '\to', '', -1.4, 't'); call mgl_set_axis_3d(gr,-1.,-1.,-2.,1.,1.,2.); call mgl_subplot(gr, 2, 1, 0); call mgl_data_fill_eq(gr, a, 'x', 0, 0); call mgl_data_fill_eq(gr, b, 'y', 0, 0); call mgl_puts_ext(gr, 0.,1.1,0., '\{x, y\}', 'C', -2., 't'); call mgl_box(gr,1); call mgl_map(gr, a, b, 'brgk', 0, 0); call mgl_subplot(gr, 2, 1, 1); call mgl_data_fill_eq(gr, a, '(x^3+y^3)/2', 0, 0); call mgl_data_fill_eq(gr, b, '(x-y)/2', 0, 0); call mgl_puts_ext(gr, 0.,1.1,0., '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}', 'C', -2., 't'); call mgl_box(gr,1); call mgl_map(gr, a, b, 'brgk', 0, 0); call mgl_box(gr,1); call mgl_map(gr,a,b,0,0,1); call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(50,40), mglData(50,40); gr.Puts(0, 0, 0, "\\to", "", -1.4); gr.SetRanges(-1,1,-1,1,-2,2); gr.SubPlot(2, 1, 0); gr.Fill(a, "x"); gr.Fill(b, "y"); gr.Puts(0, 1.1, 0, "\\{x, y\\}", "C", -2); gr.Box(); gr.Map(a, b, "brgk", 0, 0); gr.SubPlot(2, 1, 1); gr.Fill(a, "(x^3+y^3)/2"); gr.Fill(b, "(x-y)/2"); gr.Puts(0, 1.1, 0, "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2); gr.Box(); gr.Map(a, b, "brgk", 0, 0);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Plot. 3D pdf
C++ code
mglData y(50,3), x(50), y1(50), y2(50); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); y2.Modify("0.3*sin(2*pi*x)"); x.Fill(-1,1,'x'); gr->Box(); gr->Plot(x,y); gr->Traj(x,y,y1,y2);
MGL code
new y 50 3 new x 50 new y1 50 new y2 50 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify y 'sin(2*pi*x)' 1 modify y 'cos(2*pi*x)' 2 fill x -1 1 modify y1 '0.5+0.3*cos(2*pi*x)' modify y2 '0.3*sin(2*pi*x)' box plot x y traj x y y1 y2
Pure C code
HMDT y = mgl_create_data_size(50,3,1); HMDT x= mgl_create_data_size(50,1,1); HMDT y1 = mgl_create_data_size(50,1,1); HMDT y2 = mgl_create_data_size(50,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(y,"sin(2*pi*x)",1); mgl_data_modify(y,"cos(2*pi*x)",2); mgl_data_modify(x,"2*x-1",0); mgl_data_modify(y1,"0.5+0.3*cos(2*pi*x)",0); mgl_data_modify(y2,"0.3*sin(2*pi*x)",0); mgl_box(gr,1); mgl_plot_xy(gr,x,y,NULL); mgl_traj_xy(gr,yx,y,y1,y2,NULL,0,0); mgl_delete_data(y); mgl_delete_data(y1); mgl_delete_data(x); mgl_delete_data(y2);
Fortran code
integer x,y,y1,y2, mgl_create_data_size y = mgl_create_data_size(50,3,1) x= mgl_create_data_size(50,1,1); y1 = mgl_create_data_size(50,1,1); y2 = mgl_create_data_size(50,1,1); call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(y,'sin(2*pi*x)',1) call mgl_data_modify(y,'cos(2*pi*x)',2) call mgl_data_modify(x,'2*x-1',0); call mgl_data_modify(y1,'0.5+0.3*cos(2*pi*x)',0); call mgl_data_modify(y2,'0.3*sin(2*pi*x)',0); call mgl_box(gr,1) call mgl_plot_xy(gr,x,y,NULL); call mgl_traj_xy(gr,yx,y,y1,y2,NULL,0,0); call mgl_delete_data(y) call mgl_delete_data(x) call mgl_delete_data(y1) call mgl_delete_data(y2)
Python
x,y,y1,y2 = mglData(50), mglData(50,3), mglData(50), mglData(50); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); y.Modify("sin(2*pi*x)",1); y.Modify("cos(2*pi*x)",2); y1.Modify("0.5+0.3*cos(2*pi*x)"); y2.Modify("0.3*sin(2*pi*x)"); x.Fill(-1,1,'x'); gr.Box(); gr.Plot(x,y); gr.Traj(x,y,y1,y2);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Vect. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->Vect(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box vect a b
Pure C code
HMDT a = mgl_create_data_size(20,30,1); HMDT b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_vect_2d(gr,a,b,0,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_vect_2d(gr,a,b,'',0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.Vect(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of VectL. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->VectL(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box vectl a b
Pure C code
HMDT a, b; a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_vectl_2d(gr,a,b,0,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_vectl_2d(gr,a,b,'',0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.VectL(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of VectC. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->VectC(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box vectc a b
Pure C code
HMDT a, b; a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_vectc_2d(gr,a,b,0,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_vectc_2d(gr,a,b,'',0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.VectC(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Flow. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->Flow(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box flow a b
Pure C code
HMDT a = mgl_create_data_size(20,30,1); HMDT b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_flow_2d(gr,a,b,0,5,1,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_flow_2d(gr,a,b,'',5,1,0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.Flow(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Pipe. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Light(true); gr->Box(); gr->Pipe(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' light on box pipe a b
Pure C code
HMDT a = mgl_create_data_size(20,30,1); HMDT b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_set_light(gr,1); mgl_box(gr,1); mgl_pipe_2d(gr,a,b,0,0.05,5,1,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_pipe_2d(gr,a,b,'',0.05,5,1,0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Light(True); gr.Box(); gr.Pipe(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Dew. 3D pdf
C++ code
mglData a(20,30), b(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->Light(true); gr->Dew(a,b);
MGL code
new a 20 30 new b 20 30 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' box light on dew a b
Pure C code
HMDT a = mgl_create_data_size(20,30,1); HMDT b = mgl_create_data_size(20,30,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_set_light(gr,1); mgl_dew_2d(gr,a,b,0,0.); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(20,30,1); b = mgl_create_data_size(20,30,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_set_light(gr,1); call mgl_dew_2d(gr,a,b,'',0.) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(20,30), mglData(20,30); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Light(True); gr.Box(); gr.Dew(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3C. 3D pdf
C++ code
mglData a(60,50,40), b(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); b.Modify("1-2*tanh(4*(x+y-1)^2)"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->Surf3C(a, b);
MGL code
new a 60 50 40 new b 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' modify b '1-2*tanh(4*(x+y-1)^2)' rotate 40 60 light on alpha on box surf3c a b
Pure C code
HMDT a = mgl_create_data_size(60,50,40); HMDT b = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_data_modify(b,"1-2*tanh(4*(x+y-1)^2)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_surf3c(gr,a,b,0,3); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(60,50,40); b = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_data_modify(b,"1-2*tanh(4*(x+y-1)^2)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_surf3c(gr,a,b,'',3) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(60,50,40), mglData(60,50,40); a.Modify("-2*((2*x-1)^2+(2*y-1)^2+(2*z-1)^4-(2*z-1)^2-0.1)"); b.Modify("1-2*tanh(4*(x+y-1)^2)"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.Box(); gr.Surf3C(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3A. 3D pdf
C++ code
mglData a(60,50,40), b(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); b.Modify("1-2*tanh(4*(x+y-1)^2)"); gr->Rotate(40,60); gr->Light(true); gr->Alpha(true); gr->Box(); gr->Surf3A(a, b);
MGL code
new a 60 50 40 new b 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' modify b '1-2*tanh(4*(x+y-1)^2)' rotate 40 60 light on alpha on box surf3a a b
Pure C code
HMDT a, b; a = mgl_create_data_size(60,50,40); b = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_data_modify(b,"1-2*tanh(4*(x+y-1)^2)",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_box(gr,1); mgl_surf3a(gr,a,b,0,3); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(60,50,40); b = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_data_modify(b,"1-2*tanh(4*(x+y-1)^2)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_box(gr,1) call mgl_surf3a(gr,a,b,'',3) call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(60,50,40), mglData(60,50,40); a.Modify("-2*((2*x-1)^2+(2*y-1)^2+(2*z-1)^4-(2*z-1)^2-0.1)"); b.Modify("1-2*tanh(4*(x+y-1)^2)"); gr.Rotate(40,60); gr.Light(True); gr.Alpha(True); gr.Box(); gr.Surf3A(a,b);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Vect in 3D. 3D pdf
C++ code
mglData ex(10,10,10), ey(10,10,10), ez(10,10,10); ex.Fill("0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ey.Fill("0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ez.Fill("0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); gr->Rotate(40,60); gr->Box(); gr->Vect(ex, ey, ez, "bwr");
MGL code
new ex 10 10 10 new ey 10 10 10 new ez 10 10 10 fill ex '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ey '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ez '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)' rotate 40 60 box vect ex ey ez 'bwr'
Pure C code
HMDT ex, ey, ez; ex = mgl_create_data_size(10,10,10); ey = mgl_create_data_size(10,10,10); ez = mgl_create_data_size(10,10,10); mgl_data_fill_eq(gr, ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_vect_3d(gr,ex,ey,ez,"bwr"); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(ez);
Fortran code
integer ex,ey,ez, mgl_create_data_size ex = mgl_create_data_size(10,10,10) ey = mgl_create_data_size(10,10,10) ez = mgl_create_data_size(10,10,10) call mgl_data_fill_eq(gr, ex, '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ey, '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ez, '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1); call mgl_vect_3d(gr,ex,ey,ez,'bwr') call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(ez)
Python
ex, ey, ez = mglData(10,10,10), mglData(10,10,10), mglData(10,10,10); gr.Fill(ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Rotate(40,60); gr.Box(); gr.Vect(ex,ey,ez,"bwr");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of VectL in 3D. 3D pdf
C++ code
mglData ex(10,10,10), ey(10,10,10), ez(10,10,10); ex.Fill("0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ey.Fill("0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ez.Fill("0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); gr->Rotate(40,60); gr->Box(); gr->VectL(ex, ey, ez, "bwr");
MGL code
new ex 10 10 10 new ey 10 10 10 new ez 10 10 10 fill ex '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ey '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ez '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)' rotate 40 60 box vectl ex ey ez 'bwr'
Pure C code
HMDT ex, ey, ez; ex = mgl_create_data_size(10,10,10); ey = mgl_create_data_size(10,10,10); ez = mgl_create_data_size(10,10,10); mgl_data_fill_eq(gr, ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_vectl_3d(gr,ex,ey,ez,"bwr"); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(ez);
Fortran code
integer ex,ey,ez, mgl_create_data_size ex = mgl_create_data_size(10,10,10) ey = mgl_create_data_size(10,10,10) ez = mgl_create_data_size(10,10,10) call mgl_data_fill_eq(gr, ex, '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ey, '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ez, '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1); call mgl_vectl_3d(gr,ex,ey,ez,'bwr') call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(ez)
Python
ex, ey, ez = mglData(10,10,10), mglData(10,10,10), mglData(10,10,10); gr.Fill(ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Rotate(40,60); gr.Box(); gr.VectL(ex,ey,ez,"bwr");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of VectC in 3D. 3D pdf
C++ code
mglData ex(10,10,10), ey(10,10,10), ez(10,10,10); ex.Fill("0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ey.Fill("0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ez.Fill("0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); gr->Rotate(40,60); gr->Box(); gr->VectC(ex, ey, ez, "bwr");
MGL code
new ex 10 10 10 new ey 10 10 10 new ez 10 10 10 fill ex '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ey '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ez '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)' rotate 40 60 box vectc ex ey ez 'bwr'
Pure C code
HMDT ex, ey, ez; ex = mgl_create_data_size(10,10,10); ey = mgl_create_data_size(10,10,10); ez = mgl_create_data_size(10,10,10); mgl_data_fill_eq(gr, ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_vectc_3d(gr,ex,ey,ez,"bwr"); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(ez);
Fortran code
integer ex,ey,ez, mgl_create_data_size ex = mgl_create_data_size(10,10,10) ey = mgl_create_data_size(10,10,10) ez = mgl_create_data_size(10,10,10) call mgl_data_fill_eq(gr, ex, '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ey, '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ez, '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1); call mgl_vectc_3d(gr,ex,ey,ez,'bwr') call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(ez)
Python
ex, ey, ez = mglData(10,10,10), mglData(10,10,10), mglData(10,10,10); gr.Fill(ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Rotate(40,60); gr.Box(); gr.VectC(ex,ey,ez,"bwr");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Flow in 3D. 3D pdf
C++ code
mglData ex(30,30,30), ey(30,30,30), ez(30,30,30); ex.Fill("0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ey.Fill("0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ez.Fill("0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); gr->Rotate(40,60); gr->Box(); gr->Flow(ex, ey, ez, "bwr");
MGL code
new ex 30 30 30 new ey 30 30 30 new ez 30 30 30 fill ex '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ey '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ez '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)' rotate 40 60 box flow ex ey ez 'bwr'
Pure C code
HMDT ex, ey, ez; ex = mgl_create_data_size(30,30,30); ey = mgl_create_data_size(30,30,30); ez = mgl_create_data_size(30,30,30); mgl_data_fill_eq(gr, ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_flow_3d(gr,ex,ey,ez,"bwr",3,1); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(ez);
Fortran code
integer ex,ey,ez, mgl_create_data_size ex = mgl_create_data_size(30,30,30) ey = mgl_create_data_size(30,30,30) ez = mgl_create_data_size(30,30,30) call mgl_data_fill_eq(gr, ex, '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ey, '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ez, '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1); call mgl_flow_3d(gr,ex,ey,ez,'bwr',3,1) call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(ez)
Python
ex, ey, ez = mglData(10,10,10), mglData(10,10,10), mglData(10,10,10); gr.Fill(ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Rotate(40,60); gr.Box(); gr.Flow(ex,ey,ez,"bwr");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Pipe in 3D. 3D pdf
C++ code
mglData ex(10,10,10), ey(10,10,10), ez(10,10,10); ex.Fill("0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ey.Fill("0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); ez.Fill("0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)", gr->Min, gr->Max); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Pipe(ex, ey, ez, "bwr");
MGL code
new ex 10 10 10 new ey 10 10 10 new ez 10 10 10 fill ex '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ey '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)' fill ez '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)' rotate 40 60 light on box pipe ex ey ez 'bwr'
Pure C code
HMDT ex, ey, ez; ex = mgl_create_data_size(10,10,10); ey = mgl_create_data_size(10,10,10); ez = mgl_create_data_size(10,10,10); mgl_data_fill_eq(gr, ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_data_fill_eq(gr, ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)",0,0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_pipe_3d(gr,ex,ey,ez,"bwr",0.05,3,1); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(ez);
Fortran code
integer ex,ey,ez, mgl_create_data_size ex = mgl_create_data_size(10,10,10) ey = mgl_create_data_size(10,10,10) ez = mgl_create_data_size(10,10,10) call mgl_data_fill_eq(gr, ex, '0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ey, '0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_data_fill_eq(gr, ez, '0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - & 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)',0,0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1); call mgl_box(gr,1); call mgl_pipe_3d(gr,ex,ey,ez,'bwr',0.05,3,1) call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(ez)
Python
ex, ey, ez = mglData(10,10,10), mglData(10,10,10), mglData(10,10,10); gr.Fill(ex, "0.2*x/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*x/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ey, "0.2*y/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*y/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Fill(ez, "0.2*(z-0.3)/pow(x^2+y^2+(z-0.3)^2,1.5) - \ 0.2*(z+0.3)/pow(x^2+y^2+(z+0.3)^2,1.5)"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Pipe(ex,ey,ez,"bwr");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Crust. 3D pdf
C++ code
mglData a("hotdogs.pts"); a.Norm(-1,1,true); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Crust(a,"p");
MGL code
read a 'hotdogs.pts' norm a -1 1 on rotate 40 60 light on box crust a 'p'
Pure C code
HMDT a = mgl_create_data_file("hotdogs.pts"); mgl_data_norm(a,-1.,1.,1,0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_crust_tr(gr,a,"p",0.); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_file a = mgl_create_data_file("hotdogs.pts") call mgl_data_norm(a,-1.,1.,1,0) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_crust_tr(gr,a,"p",0.) call mgl_delete_data(a)
Python
a = mglData("hotdogs.pts"); a.Norm(-1,1,True); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Crust(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Dots. 3D pdf
C++ code
mglData a("hotdogs.pts"); a.Norm(-1,1,true); gr->Rotate(40,60); gr->Box(); gr->Dots(a,"p");
MGL code
read a 'hotdogs.pts' norm a -1 1 on rotate 40 60 box dots a 'p'
Pure C code
HMDT a = mgl_create_data_file("hotdogs.pts"); mgl_data_norm(a,-1.,1.,1,0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_dots_tr(gr,a,"p"); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_file a = mgl_create_data_file("hotdogs.pts") call mgl_data_norm(a,-1.,1.,1,0) call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_dots_tr(gr,a,"p") call mgl_delete_data(a)
Python
a = mglData("hotdogs.pts"); a.Norm(-1,1,True); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Dots(a);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Legend usage. 3D pdf
C++ code
mglData f(50,3); f.Modify("sin(2*pi*x*x)",0); f.Modify("sin(2*pi*x)",1); f.Modify("sin(2*pi*sqrt(x))",2); gr->Axis(mglPoint(0,-1),mglPoint(1,1)); gr->Box(); gr->Plot(f); gr->Axis(); gr->AddLegend("sin(\\pi {x^2})","b"); gr->AddLegend("sin(\\pi x)","g*"); gr->AddLegend("sin(\\pi \\sqrt{\\a x})","r+"); gr->Legend();
MGL code
new f 50 3 modify f 'sin(2*pi*x*x)' modify f 'sin(2*pi*x)' 1 modify f 'sin(2*pi*sqrt(x))' 2 axis 0 -1 1 1 box plot f axis addlegend 'sin(\pi {x^2})' 'b' addlegend 'sin(\pi x)' 'g*' addlegend 'sin(\pi \sqrt{\a x})' 'r+' legend
Pure C code
HMDT f = mgl_create_data_size(50,3,1); mgl_data_modify(f,"sin(2*pi*x*x)",0); mgl_data_modify(f,"sin(2*pi*x)",1); mgl_data_modify(f,"sin(2*pi*sqrt(x))",2); mgl_set_axis(gr, 0.,-1.,0., 1.,1.,1., 0.,0.,0.); mgl_box(gr,1); mgl_plot(gr,f,NULL); mgl_axis(gr,"xy"); mgl_add_legend(gr,"sin(\\pi {x^2})","b"); mgl_add_legend(gr,"sin(\\pi x)","g*"); mgl_add_legend(gr,"sin(\\pi \\sqrt{\\a x})","r+"); mgl_legend(gr,3,"rL",-1.,0.1); mgl_delete_data(f);
Fortran code
integer f, mgl_create_data_size f = mgl_create_data_size(50,3,1) call mgl_data_modify(f,'sin(2*pi*x*x)',0) call mgl_data_modify(f,'sin(2*pi*x)',1) call mgl_data_modify(f,'sin(2*pi*sqrt(x))',2) call mgl_set_axis(gr, 0.,-1.,0., 1.,1.,1., 0.,0.,0.) call mgl_box(gr,1) call mgl_plot(gr,f,'') call mgl_axis(gr,'xy') call mgl_add_legend(gr,'sin(\pi {x^2})','b'); call mgl_add_legend(gr,'sin(\pi x)','g*'); call mgl_add_legend(gr,'sin(\pi \sqrt{\a x})','r+'); call mgl_legend(gr,3,'rL',-1.,0.1); call mgl_delete_data(f)
Python
f = mglData(50,3); f.Modify("sin(2*pi*x*x)",0); f.Modify("sin(2*pi*x)",1); f.Modify("sin(2*pi*sqrt(x))",2); gr.SetRanges(0,1,-1,1); gr.Box(); gr.Axis(); gr.Plot(f); gr.AddLegend("sin(\\pi x^2)","b"); gr.AddLegend("sin(\\pi x)","g*"); gr.AddLegend("sin(\\pi\\sqrt{\\a x})","r+"); gr.Legend();
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of adding mesh. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Light(true); gr->Alpha(true); gr->SubPlot(2,2,0); gr->Rotate(40,60); gr->Surf(a,"BbcyrR#"); gr->Box(); gr->SubPlot(2,2,1); gr->Rotate(40,60); gr->Dens(a,"BbcyrR#"); gr->Box(); gr->SubPlot(2,2,2); gr->Rotate(40,60); gr->Cont(a,"BbcyrR#"); gr->Box(); gr->SubPlot(2,2,3); gr->Rotate(40,60); gr->Axial(a,"BbcyrR#"); gr->Box();
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' alpha on light on subplot 2 2 0 rotate 40 60 surf a 'BbcyrR#' box subplot 2 2 1 rotate 40 60 dens a 'BbcyrR#' box subplot 2 2 2 rotate 40 60 cont a 'BbcyrR#' box subplot 2 2 3 rotate 40 60 axial a 'BbcyrR#' box
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_set_alpha(gr,1); mgl_set_light(gr,1); mgl_subplot(gr,2,2,0); mgl_rotate(gr,40.,60.,0.); mgl_surf(gr,a,"BbcyrR#"); mgl_box(gr,1); mgl_subplot(gr,2,2,1); mgl_rotate(gr,40.,60.,0.); mgl_dens(gr,a,"BbcyrR#",-1.); mgl_box(gr,1); mgl_subplot(gr,2,2,2); mgl_rotate(gr,40.,60.,0.); mgl_cont(gr,a,"BbcyrR#",7,NAN); mgl_box(gr,1); mgl_subplot(gr,2,2,3); mgl_rotate(gr,40.,60.,0.); mgl_axial(gr,a,"BbcyrR#",3); mgl_box(gr,1); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size real zero, nan zero=0; nan=zero/zero a = mgl_create_data_size(50,40,1) call mgl_data_modify(a,'0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))',0) call mgl_set_alpha(gr,1) call mgl_set_light(gr,1) call mgl_subplot(gr,2,2,0) call mgl_rotate(gr,40.,60.,0.) call mgl_surf(gr,a,'BbcyrR#') call mgl_box(gr,1) call mgl_subplot(gr,2,2,1) call mgl_rotate(gr,40.,60.,0.) call mgl_dens(gr,a,'BbcyrR#',-1.) call mgl_box(gr,1) call mgl_subplot(gr,2,2,2) call mgl_rotate(gr,40.,60.,0.) call mgl_cont(gr,a,'BbcyrR#',7,nan) call mgl_box(gr,1) call mgl_subplot(gr,2,2,3) call mgl_rotate(gr,40.,60.,0.) call mgl_axial(gr,a,'BbcyrR#',3) call mgl_box(gr,1) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Light(True); gr.Alpha(True); gr.SubPlot(2,2,0); gr.Rotate(40,60); gr.Surf(a,"BbcyrR#"); gr.Box(); gr.SubPlot(2,2,1); gr.Rotate(40,60); gr.Dens(a,"BbcyrR#"); gr.Box(); gr.SubPlot(2,2,2); gr.Rotate(40,60); gr.Cont(a,"BbcyrR#"); gr.Box(); gr.SubPlot(2,2,3); gr.Rotate(40,60); gr.Axial(a,"BbcyrR#"); gr.Box();
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf & Cont. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Surf(a); gr->Cont(a,"y");
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on box surf a cont a 'y'
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_surf(gr,a,0); mgl_cont(gr,a,"y",7,NAN); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size real zero, nan zero = 0; nan = zero/zero a = mgl_create_data_size(50,40,1) call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_surf(gr,a,'') call mgl_cont(gr,a,'y',7,nan) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Surf(a); gr.Cont(a,"y");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Flow & Dens. 3D pdf
C++ code
mglData a(50,40), b(50,40), d(a); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))"); d.Modify("sqrt(v^2+w^2)",a,b); gr->Box(); gr->Flow(a,b,"br"); gr->Dens(d,"BbcyrR");
MGL code
new a 50 40 new b 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' modify b '0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))' copy d a modify d 'sqrt(v^2+w^2)' a b box flow a b 'br' dens d 'BbcyrR'
Pure C code
HMDT a, b, d; a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); d = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_data_modify(d,"sqrt(v^2+w^2)",a,b); mgl_box(gr,1); mgl_flow_2d(gr,a,b,"br",5,1,0.); mgl_dens(gr,d,"BbcyrR",-1.); mgl_delete_data(a); mgl_delete_data(b); mgl_delete_data(d);
Fortran code
integer a,b,d, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); d = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(b,"0.6*cos(2*pi*x)*cos(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_data_modify(d,"sqrt(v^2+w^2)",a,b); call mgl_box(gr,1) call mgl_flow_2d(gr,a,b,'br',5,1,0.) call mgl_dens(gr,d,'BbcyrR',-1.); call mgl_delete_data(a) call mgl_delete_data(b) call mgl_delete_data(d)
Python
a, b= mglData(50,40), mglData(50,40); d = mglData(a) a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); b.Modify("0.6*cos(2*pi*x)*cos(3*pi*y)+0.4*cos(3*pi*(x*y))"); d.Modify("sqrt(v^2+w^2)",a,b); gr.Box(); gr.Flow(a,b,"br"); gr.Dens(d,"BbcyrR");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf with several light. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Rotate(40,60); gr->Light(true); gr->Light(1,mglPoint(0,1,0),'c'); gr->Light(2,mglPoint(1,0,0),'y'); gr->Light(3,mglPoint(0,-1,0),'m'); gr->Box(); gr->Surf(a,"h");
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' rotate 40 60 light on light 1 0 1 0 'c' light 2 1 0 0 'y' light 3 0 -1 0 'm' box surf a 'h'
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_add_light_rgb(gr,1,0.,1.,0.,1, 0.,1.,1.,0.5); mgl_add_light_rgb(gr,2,1.,0.,0.,1, 1.,1.,0.,0.5); mgl_add_light_rgb(gr,3,0.,-1.,0.,1, 1.,0.,1.,0.5); mgl_box(gr,1); mgl_surf(gr,a,"h"); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_add_light_rgb(gr,1,0.,1.,0.,1, 0.,1.,1.,0.5) call mgl_add_light_rgb(gr,2,1.,0.,0.,1, 1.,1.,0.,0.5) call mgl_add_light_rgb(gr,3,0.,-1.,0.,1, 1.,0.,1.,0.5) call mgl_box(gr,1) call mgl_surf(gr,a,'h') call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Rotate(40,60); gr.Light(True); gr.AddLight(1,0,1,0,"c"); gr.AddLight(2,1,0,0,"y"); gr.AddLight(3,0,-1,0,"m"); gr.Box(); gr.Surf(a,"h")
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of mirrored surface. 3D pdf
C++ code
mglData a(30,40),x(30),y1(40),y2(40); a.Modify("pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)"); x.Fill(-1,1); y1.Fill(0,1); y2.Fill(0,-1); gr->Rotate(40,60); gr->Light(true); gr->Box(); gr->Surf(x,y1,a,"r"); gr->Surf(x,y2,a,"b");
MGL code
new a 30 40 modify a 'pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)' rotate 40 60 light on surf a 'r'; yrange 0 1 surf a 'b'; yrange 0 -1 box
or
new a 30 40 var x 30 -1 1 var y1 40 0 1 var y2 40 0 -1 modify a 'pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)' rotate 40 60 light on surf x y1 a 'r' surf x y2 a 'b' box
Pure C code
HMDT a,x,y1,y2; a = mgl_create_data_size(30,40,1); x = mgl_create_data_size(30,1,1); y1 = mgl_create_data_size(40,1,1); y2 = mgl_create_data_size(40,1,1); mgl_data_modify(a,"pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)",0); mgl_data_fill(x,-1.,1.,'x'); mgl_data_fill(y1,0.,1.,'x'); mgl_data_fill(y2,0.,-1.,'x'); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_box(gr,1); mgl_surf_xy(gr,x,y1,a,"r"); mgl_surf_xy(gr,x,y2,a,"b"); mgl_delete_data(a); mgl_delete_data(y1); mgl_delete_data(x); mgl_delete_data(y2);
Fortran code
integer a,x,y1,y2, mgl_create_data_size a = mgl_create_data_size(30,40,1) x = mgl_create_data_size(30,1,1) y1 = mgl_create_data_size(40,1,1) y2 = mgl_create_data_size(40,1,1) call mgl_data_modify(a,'pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)',0) call mgl_data_fill(x,-1.,1.,'x') call mgl_data_fill(y1,0.,1.,'x') call mgl_data_fill(y2,0.,-1.,'x') call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_box(gr,1) call mgl_surf_xy(gr,x,y1,a,'r') call mgl_surf_xy(gr,x,y2,a,'b') call mgl_delete_data(a) call mgl_delete_data(y1) call mgl_delete_data(x) call mgl_delete_data(y2)
Python
a, x, y1, y2 = mglData(30,40), mglData(30), mglData(40), mglData(40); a.Modify("pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)"); x.Fill(-1,1); y1.Fill(0,1); y2.Fill(0,-1); gr.Rotate(40,60); gr.Light(True); gr.Box(); gr.Surf(x,y1,a,"r"); gr.Surf(x,y2,a,"b");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Cont with labels. 3D pdf
C++ code
mglData a(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))"); gr->Box(); gr->Cont(a,"BbcyrRt");
MGL code
new a 50 40 modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))' box cont a 'BbcyrRt'
Pure C code
HMDT a = mgl_create_data_size(50,40,1); mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); mgl_box(gr,1); mgl_cont(gr,a,"BbcyrRt",7,0); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(50,40,1); call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0); call mgl_box(gr,1) call mgl_cont(gr,a,'BbcyrRt',7,0) call mgl_delete_data(a)
Python
a = mglData(50,40); a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))"); gr.Box(); gr.Cont(a,"BbcyrRt");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Ternary plot. 3D pdf
C++ code
mglData x(50),y(50),rx(10),ry(10), a(20,30); a.Modify("4*x*y"); x.Modify("0.25*(1+cos(2*pi*x))"); y.Modify("0.25*(1+sin(2*pi*x))"); rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx); gr->Text(mglPoint(-0.8,1.3), "Ternary plot (x+y+t=1)"); gr->Ternary(true); gr->Plot(x,y,"r2"); gr->Plot(rx,ry,"q^ "); gr->Cont(a); gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2"); gr->Axis(); gr->Grid("xyz","B;"); gr->Label('x',"x comp."); gr->Label('y',"y comp."); gr->Label('t',"t comp.");
MGL code
new rx 10 new ry 10 new x 50 new y 50 new a 20 30 modify a '4*x*y' modify x '0.25*(1+cos(2*pi*x))' modify y '0.25*(1+sin(2*pi*x))' modify rx 'rnd' modify ry 'rnd*(1-v)' rx text -0.8 1.3 'Ternary plot (x+y+t=1)' ternary on plot x y 'r2' plot rx ry 'q^ ' cont a line 0.5 0 0 0.75 'g2' axis grid 'xyz' 'B;' xlabel 'x comp.' ylabel 'y comp.' tlabel 't comp.'
Pure C code
HMDT x,y,rx,ry,a; x = mgl_create_data_size(50,1,1); y = mgl_create_data_size(50,1,1); rx = mgl_create_data_size(50,1,1); ry = mgl_create_data_size(50,1,1); a = mgl_create_data_size(20,30,1); mgl_data_modify(x,"0.25*(1+cos(2*pi*x))",0); mgl_data_modify(y,"0.25*(1+sin(2*pi*x))",0); mgl_data_modify(rx,"rnd",0); mgl_data_modify_vw(ry,"(1-v)*rnd",rx,0); mgl_data_modify(a,"4*x*y",0); mgl_puts_ext(gr,-0.8,1.3,0.,"Ternary plot (x+y+t=1)","C",-1.4,'t'); mgl_set_ternary(gr,1); mgl_plot_xy(gr,x,y,"r2"); mgl_plot_xy(gr,rx,ry,"q^ "); mgl_cont(gr,a,"",7,0.); mgl_line(gr,0.5,0.,0.,0.,0.75,0.,"g2",2); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz","B:"); mgl_label(gr,'x',"x comp"); mgl_label(gr,'y',"y comp"); mgl_label(gr,'t',"t comp"); mgl_delete_data(a); mgl_delete_data(x); mgl_delete_data(y); mgl_delete_data(rx); mgl_delete_data(ry);
Fortran code
integer a,x,y,rx,ry, mgl_create_data_size x = mgl_create_data_size(50,1,1) y = mgl_create_data_size(50,1,1) rx = mgl_create_data_size(50,1,1) ry = mgl_create_data_size(50,1,1) a = mgl_create_data_size(20,30,1) call mgl_data_modify(x,'0.25*(1+cos(2*pi*x))',0) call mgl_data_modify(y,'0.25*(1+sin(2*pi*x))',0) call mgl_data_modify(rx,'rnd',0) call mgl_data_modify_vw(ry,'(1-v)*rnd',rx,rx) call mgl_data_modify(a,'4*x*y',0) call mgl_puts_ext(gr,-0.8,1.3,0.,'Ternary plot (x+y+t=1)','C',-1.4,'t') call mgl_set_ternary(gr,1) call mgl_plot_xy(gr,x,y,'r2') call mgl_plot_xy(gr,rx,ry,'q^ ') call mgl_cont(gr,a,'',7,0.) call mgl_line(gr,0.5,0.,0.,0.,0.75,0.,'g2',2) call mgl_axis(gr,'xyz') call mgl_axis_grid(gr,'xyz','B:') call mgl_label(gr,'x','x comp') call mgl_label(gr,'y','y comp') call mgl_label(gr,'t','t comp') call mgl_delete_data(a) call mgl_delete_data(x) call mgl_delete_data(y) call mgl_delete_data(rx) call mgl_delete_data(ry)
Python
x, y, rx, ry, a = mglData(50), mglData(50), mglData(10), mglData(10), mglData(20,30); a.Modify("4*x*y"); x.Modify("0.25*(1+cos(2*pi*x))"); y.Modify("0.25*(1+sin(2*pi*x))"); rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx); gr.Puts(-0.8,1.3,0,"Ternary plot (x+y+t=1)","C",-1.4); gr.Ternary(True); gr.Plot(x,y,"r2"); gr.Plot(rx,ry,"q^ "); gr.Cont(a); gr.Line(0.5,0,0,0,0.75,0,"g2"); gr.Axis(); gr.Grid("xyz","B;"); gr.Label("x","x comp."); gr.Label("y","y comp."); gr.Label("t","t comp.");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Surf3 colored by coordinates. 3D pdf
C++ code
mglData a(60,50,40); a.Modify("-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)"); gr->Rotate(40,60); gr->Box(); gr->Surf3(a,"bgrd");
MGL code
new a 60 50 40 modify a '-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)' rotate 40 60 box surf3 a 'bgrd'
Pure C code
HMDT a = mgl_create_data_size(60,50,40); mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); mgl_rotate(gr,40.,60.,0.); mgl_box(gr,1); mgl_surf3(gr,a,"bgrd",3); mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(60,50,40); call mgl_data_modify(a,"-2*((2*x-1)^2 + (2*y-1)^2 + (2*z-1)^4 - (2*z-1)^2 - 0.1)",0); call mgl_rotate(gr,40.,60.,0.) call mgl_box(gr,1) call mgl_surf3(gr,a,'bgrd',3) call mgl_delete_data(a)
Python
a = mglData(60,50,40); a.Modify("-2*((2*x-1)^2+(2*y-1)^2+(2*z-1)^4-(2*z-1)^2-0.1)"); gr.Rotate(40,60); gr.Box(); gr.Surf3(a,"bgrd");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Drop(s). 3D pdf
C++ code
gr->Light(true); gr->Puts(mglPoint(-1,1.2),"sh=0"); gr->Drop(mglPoint(-1,0),mglPoint(0,1),0.5,"r",0); gr->Puts(mglPoint(-0.33,1.2),"sh=0.33"); gr->Drop(mglPoint(-0.33,0),mglPoint(0,1),0.5,"r",0.33); gr->Puts(mglPoint(0.33,1.2),"sh=0.67"); gr->Drop(mglPoint(0.33,0),mglPoint(0,1),0.5,"r",0.67); gr->Puts(mglPoint(1,1.2),"sh=1"); gr->Drop(mglPoint(1,0),mglPoint(0,1),0.5,"r",1); gr->Ball(mglPoint(-1,0,1),'k'); gr->Ball(mglPoint(-0.33,0,1),'k'); gr->Ball(mglPoint(0.33,0,1),'k'); gr->Ball(mglPoint(1,0,1),'k'); gr->Line(mglPoint(-1,0,1),mglPoint(1,0,1),"b");
MGL code
light on text -1 1.2 'sh=0' drop -1 0 0 1 0.5 'r' 0 text -0.33 1.2 'sh=0.33' drop -0.33 0 0 1 0.5 'r' 0.33 text 0.33 1.2 'sh=0.67' drop 0.33 0 0 1 0.5 'r' 0.67 text 1 1.2 'sh=1' drop 1 0 0 1 0.5 'r' 1 ball -1 0 1 'k' ball -0.33 0 1 'k' ball 0.33 0 1 'k' ball 1 0 1 'k' line -1 0 1 1 0 1 'b' new h 100 modify h '0.25*(1+x)^2' plot h 'k|' text -1 0.6 'h\sim(1+sh)^2' 'rL'
Pure C code
mgl_set_light(gr,1); mgl_puts(gr,-1.,1.2,0.,"sh=0"); mgl_drop(gr,-1.,0.,0.,0.,1.,0.,0.5,"r",0.,1.); mgl_puts(gr,-0.33,1.2,0.,"sh=0.33"); mgl_drop(gr,-0.33,0.,0.,0.,1.,0.,0.5,"r",0.33,1.); mgl_puts(gr,0.33,1.2,0.,"sh=0.67"); mgl_drop(gr,0.33,0.,0.,0.,1.,0.,0.5,"r",0.67,1.); mgl_puts(gr,1.,1.2,0.,"sh=1"); mgl_drop(gr,1.,0.,0.,0.,1.,0.,0.5,"r",1.,1.); mgl_ball_str(gr,-1.,0.,1.,"k"); mgl_ball_str(gr,-0.33,0.,1.,"k"); mgl_ball_str(gr,0.33,0.,1.,"k"); mgl_ball_str(gr,1.,0.,1.,"k"); mgl_line(gr,-1.,0.,1.,1.,0.,1.,"b",2);
Fortran code
call mgl_set_light(gr,1); call mgl_puts(gr,-1.,1.2,0.,"sh=0"); call mgl_drop(gr,-1.,0.,0.,0.,1.,0.,0.5,"r",0.,1.); call mgl_puts(gr,-0.33,1.2,0.,"sh=0.33"); call mgl_drop(gr,-0.33,0.,0.,0.,1.,0.,0.5,"r",0.33,1.); call mgl_puts(gr,0.33,1.2,0.,"sh=0.67"); call mgl_drop(gr,0.33,0.,0.,0.,1.,0.,0.5,"r",0.67,1.); call mgl_puts(gr,1.,1.2,0.,"sh=1"); call mgl_drop(gr,1.,0.,0.,0.,1.,0.,0.5,"r",1.,1.); call mgl_ball_str(gr,-1.,0.,1.,"k"); call mgl_ball_str(gr,-0.33,0.,1.,"k"); call mgl_ball_str(gr,0.33,0.,1.,"k"); call mgl_ball_str(gr,1.,0.,1.,"k"); call mgl_line(gr,-1.,0.,1.,1.,0.,1.,"b",2);
Python
gr.Light(True); gr.Puts(-1,1.2,0,"sh=0","rC"); gr.Drop(-1,0,0,0,1,0,0.5,"r",0); gr.Puts(-0.33,1.2,0,"sh=0.33","rC"); gr.Drop(-0.33,0,0,0,1,0,0.5,"r",0.33); gr.Puts(0.33,1.2,0,"sh=0.67","rC"); gr.Drop(0.33,0,0,0,1,0,0.5,"r",0.67); gr.Puts(1,1.2,0,"sh=1","rC"); gr.Drop(1,0,0,0,1,0,0.5,"r",1); gr.Ball(-1,0,1,"k"); gr.Ball(-0.33,0,1,"k"); gr.Ball(0.33,0,1,"k"); gr.Ball(1,0,1,"k"); gr.Line(-1,0,1,1,0,1,"b");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of molecules drawing. 3D pdf
C++ code
gr->Alpha(true); gr->Light(true); gr->SubPlot(2,2,0); gr->Text(mglPoint(0,1.2),"Methane, CH_4",0,-3); gr->Rotate(60,120); gr->Sphere(mglPoint(0,0,0),0.25,"k"); gr->Drop(mglPoint(0,0,0),mglPoint(0,0,1),0.35,"h",1,2); gr->Sphere(mglPoint(0,0,0.7),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(-0.94,0,-0.33),0.35,"h",1,2); gr->Sphere(mglPoint(-0.66,0,-0.23),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(0.47,0.82,-0.33),0.35,"h",1,2); gr->Sphere(mglPoint(0.33,0.57,-0.23),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2); gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g"); gr->SubPlot(2,2,1); gr->Text(mglPoint(0,1.2),"Water, H{_2}O",0,-3); gr->Rotate(60,100); gr->Sphere(mglPoint(0,0,0),0.25,"r"); gr->Drop(mglPoint(0,0,0),mglPoint(0.3,0.5,0),0.3,"m",1,2); gr->Sphere(mglPoint(0.3,0.5,0),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(0.3,-0.5,0),0.3,"m",1,2); gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g"); gr->SubPlot(2,2,2); gr->Text(mglPoint(0,1.2),"Oxygen, O_2",0,-3); gr->Rotate(60,120); gr->Drop(mglPoint(0,0.5,0),mglPoint(0,-0.3,0),0.3,"m",1,2); gr->Sphere(mglPoint(0,0.5,0),0.25,"r"); gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2); gr->Sphere(mglPoint(0,-0.5,0),0.25,"r"); gr->SubPlot(2,2,3); gr->Text(mglPoint(0,1.2),"Ammonia, NH_3",0,-3); gr->Rotate(60,120); gr->Sphere(mglPoint(0,0,0),0.25,"b"); gr->Drop(mglPoint(0,0,0),mglPoint(0.33,0.57,0),0.32,"n",1,2); gr->Sphere(mglPoint(0.33,0.57,0),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(0.33,-0.57,0),0.32,"n",1,2); gr->Sphere(mglPoint(0.33,-0.57,0),0.25,"g"); gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2); gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
MGL code
alpha on light on subplot 2 2 0 text 0 1.2 'Methane, CH_4' '' -3 rotate 60 120 sphere 0 0 0 0.25 'k' drop 0 0 0 0 0 1 0.35 'h' 1 2 sphere 0 0 0.7 0.25 'g' drop 0 0 0 -0.94 0 -0.33 0.35 'h' 1 2 sphere -0.66 0 -0.23 0.25 'g' drop 0 0 0 0.47 0.82 -0.33 0.35 'h' 1 2 sphere 0.33 0.57 -0.23 0.25 'g' drop 0 0 0 0.47 -0.82 -0.33 0.35 'h' 1 2 sphere 0.33 -0.57 -0.23 0.25 'g' subplot 2 2 1 text 0 1.2 'Water, H{_2}O' '' -3 rotate 60 100 sphere 0 0 0 0.25 'r' drop 0 0 0 0.3 0.5 0 0.3 'm' 1 2 sphere 0.3 0.5 0 0.25 'g' drop 0 0 0 0.3 -0.5 0 0.3 'm' 1 2 sphere 0.3 -0.5 0 0.25 'g' subplot 2 2 2 text 0 1.2 'Oxygen, O_2' '' -3 rotate 60 120 drop 0 0.5 0 0 -0.3 0 0.3 'm' 1 2 sphere 0 0.5 0 0.25 'r' drop 0 -0.5 0 0 0.3 0 0.3 'm' 1 2 sphere 0 -0.5 0 0.25 'r' subplot 2 2 3 text 0 1.2 0 'Ammonia, NH_3' '' -3 rotate 60 120 sphere 0 0 0 0.25 'b' drop 0 0 0 0.33 0.57 0 0.32 'n' 1 2 sphere 0.33 0.57 0 0.25 'g' drop 0 0 0 0.33 -0.57 0 0.32 'n' 1 2 sphere 0.33 -0.57 0 0.25 'g' drop 0 0 0 -0.65 0 0 0.32 'n' 1 2 sphere -0.65 0 0 0.25 'g'
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of curvelinear coorinates usage. 3D pdf
C++ code
gr->Org = mglPoint(-1,1,-1); gr->SubPlot(2,2,0); gr->Rotate(60,40); gr->Line(mglPoint(-1,0.5,0),mglPoint(1,0.5,0),"r2",100); gr->Axis(); gr->Grid(); gr->Text(mglPoint(0,1.3,1),"Cartesian"); gr->SubPlot(2,2,1); gr->Rotate(60,40); gr->Axis("y*sin(pi*x)","y*cos(pi*x)",0); gr->Line(mglPoint(-1,0.5,0),mglPoint(1,0.5,0),"r2",100); gr->Axis(); gr->Grid(); gr->Text(mglPoint(0,1.3,1),"Cylindrical"); gr->SubPlot(2,2,2); gr->Rotate(60,40); gr->Axis("2*y*x","y*y - x*x",0); gr->Line(mglPoint(-1,0.5,0),mglPoint(1,0.5,0),"r2",100); gr->Axis(); gr->Grid(); gr->Text(mglPoint(0,1.3,1),"Parabolic"); gr->SubPlot(2,2,3); gr->Rotate(60,40); gr->Axis("y*sin(pi*x)","y*cos(pi*x)","x+z"); gr->Line(mglPoint(-1,0.5,0),mglPoint(1,0.5,0),"r2",100); gr->Axis(); gr->Grid(); gr->Text(mglPoint(0,1.3,1),"Spiral"); gr->Axis(0,0,0); // set to default Cartesian
MGL code
origin -1 1 -1 subplot 2 2 0 rotate 60 40 line -1 0.5 0 1 0.5 0 'r2' axis grid text 0 1.3 1 'Cartesian' subplot 2 2 1 rotate 60 40 axis 'y*sin(pi*x)' 'y*cos(pi*x)' '' line -1 0.5 0 1 0.5 0 'r2' axis grid text 0 1.3 1 'Cylindrical' subplot 2 2 2 rotate 60 40 axis '2*y*x' 'y*y - x*x' '' line -1 0.5 0 1 0.5 0 'r2' axis grid text 0 1.3 1 'Parabolic' subplot 2 2 3 rotate 60 40 axis 'y*sin(pi*x)' 'y*cos(pi*x)' 'x+z' line -1 0.5 0 1 0.5 0 'r2' axis grid text 0 1.3 1 'Spiral' axis '' '' '' # set to default Cartesian
Pure C code
mgl_set_origin(gr,-1,1,-1); mgl_subplot(gr,2,2,0); mgl_rotate(gr,60,40,0); mgl_line(gr,-1,0.5,0,1,0.5,0,"r2",100); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz","B"); mgl_text(gr,0,1.3,1,"Cartesian"); mgl_subplot(gr,2,2,1); mgl_rotate(gr,60,40,0); mgl_set_func(gr,"y*sin(pi*x)","y*cos(pi*x)",0); mgl_line(gr,-1,0.5,0,1,0.5,0,"r2",100); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz","B"); mgl_text(gr,0,1.3,1,"Cylindrical"); mgl_subplot(gr,2,2,2); mgl_rotate(gr,60,40,0); mgl_set_func(gr,"2*y*x","y*y - x*x",""); mgl_line(gr,-1,0.5,0,1,0.5,0,"r2",100); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz","B"); mgl_text(gr,0,1.3,1,"Parabolic"); mgl_subplot(gr,2,2,3); mgl_rotate(gr,60,40,0); mgl_set_func(gr,"y*sin(pi*x)","y*cos(pi*x)","x+z"); mgl_line(gr,-1,0.5,0,1,0.5,0,"r2",100); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz","B"); mgl_text(gr,0,1.3,1,"Spiral"); mgl_set_func(gr,0,0,0); /* set to default Cartesian */
Fortran code
call mgl_set_origin(gr,-1.,1.,-1.) call mgl_subplot(gr,2,2,0) call mgl_rotate(gr,60.,40.,0.) call mgl_line(gr,-1.,0.5,0.,1.,0.5,0.,'r2',100) call mgl_axis(gr,'xyz') call mgl_axis_grid(gr,'xyz','B') call mgl_text(gr,0.,1.3,1.,'Cartesian') call mgl_subplot(gr,2,2,1) call mgl_rotate(gr,60.,40.,0.) call mgl_set_func(gr,'y*sin(pi*x)','y*cos(pi*x)','') call mgl_line(gr,-1.,0.5,0.,1.,0.5,0.,'r2',100) call mgl_axis(gr,'xyz') call mgl_axis_grid(gr,'xyz','B') call mgl_text(gr,0.,1.3,1.,'Cylindrical') call mgl_subplot(gr,2,2,2) call mgl_rotate(gr,60.,40.,0.) call mgl_set_func(gr,'2*y*x','y*y - x*x','') call mgl_line(gr,-1.,0.5,0.,1.,0.5,0.,'r2',100) call mgl_axis(gr,'xyz') call mgl_axis_grid(gr,'xyz','B') call mgl_text(gr,0.,1.3,1.,"Parabolic") call mgl_subplot(gr,2,2,3) call mgl_rotate(gr,60.,40.,0.) call mgl_set_func(gr,'y*sin(pi*x)','y*cos(pi*x)','x+z') call mgl_line(gr,-1.,0.5,0.,1.,0.5,0.,'r2',100) call mgl_axis(gr,'xyz') call mgl_axis_grid(gr,'xyz','B') call mgl_text(gr,0.,1.3,1.,'Spiral') call mgl_set_func(gr,'','','') ! set to default Cartesian
Python
gr.SetOrigin(-1,1,-1); gr.SubPlot(2,2,0); gr.Rotate(60,40); gr.Line(-1,0.5,0,1,0.5,0,"r2",100); gr.Axis(); gr.Grid(); gr.Puts(0,1.3,1,"Gartesian","rC",-1.5); gr.SubPlot(2,2,1); gr.Rotate(60,40); gr.SetFunc("y*sin(pi*x)","y*cos(pi*x)",""); gr.Line(-1,0.5,0,1,0.5,0,"r2",100); gr.Axis(); gr.Grid(); gr.Puts(0,1.3,1,"Cylindrical","rC",-1.5); gr.SubPlot(2,2,2); gr.Rotate(60,40); gr.SetFunc("2*y*x","y*y-x*x",""); gr.Line(-1,0.5,0,1,0.5,0,"r2",100); gr.Axis(); gr.Grid(); gr.Puts(0,1.3,1,"Parabolic","rC",-1.5); gr.SubPlot(2,2,3); gr.Rotate(60,40); gr.SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z"); gr.Line(-1,0.5,0,1,0.5,0,"r2",100); gr.Axis(); gr.Grid(); gr.Puts(0,1.3,1,"Spiral","rC",-1.5); gr.SetFunc("","",""); # set to default Gartesian
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of 2 axes on the plot. 3D pdf
C++ code
mglData y1(50), y2(50); y1.Modify("0.3*sin(2*pi*x)"); y2.Modify("0.5+0.3*cos(2*pi*x)"); gr->Axis(mglPoint(-1,-1,-1),mglPoint(1,1,1),mglPoint(-1,-1,-1)); gr->Axis(); gr->Label('y',"axis 1",0); gr->Plot(y1,"b"); gr->Axis(mglPoint(0,0,0),mglPoint(1,1,1),mglPoint(1,1,1)); gr->Axis(); gr->Label('y',"axis 2",0); gr->Stem(y2,"r");
MGL code
new y1 50 new y2 50 modify y1 '0.3*sin(2*pi*x)' modify y2 '0.5+0.3*cos(2*pi*x)' axis -1 -1 -1 1 1 1 origin -1 -1 -1 axis ylabel 'axis 1' 0 plot y1 'b' axis 0 0 0 1 1 1 origin 1 1 1 axis ylabel 'axis 2' 0 stem y2 'r'
Pure C code
HMDT y1 = mgl_create_data_size(50,1,1); HMDT y2 = mgl_create_data_size(50,1,1); mgl_data_modify(y1,"0.3*sin(2*pi*x)",0); mgl_data_modify(y2,"0.5+0.3*cos(2*pi*x)",0); mgl_set_axis_2d(gr,-1.,1.,-1.,1.); mgl_set_origin(gr,-1.,-1.,-1.); mgl_axis(gr,"xyz"); mgl_label_ext(gr,'y',"axis 1",0,-1.4,0.); mgl_plot(gr,y1,"b"); mgl_set_axis_2d(gr,0.,0.,1.,1.); mgl_set_origin(gr,1.,1.,1.); mgl_axis(gr,"xyz"); mgl_label_ext(gr,'y',"axis 2",0,-1.4,0.); mgl_stem(gr,y2,"r");
Fortran code
integer y1,y2, mgl_create_data_size y1 = mgl_create_data_size(50,1,1) y2 = mgl_create_data_size(50,1,1) call mgl_data_modify(y1,'0.3*sin(2*pi*x)',0) call mgl_data_modify(y2,'0.5+0.3*cos(2*pi*x)',0) call mgl_set_axis_2d(gr,-1.,1.,-1.,1.) call mgl_set_origin(gr,-1.,-1.,-1.) call mgl_axis(gr,'xyz') call mgl_label_ext(gr,'y','axis 1',0,-1.4,0.) call mgl_plot(gr,y1,'b') call mgl_set_axis_2d(gr,0.,0.,1.,1.) call mgl_set_origin(gr,1.,1.,1.) call mgl_axis(gr,'xyz') call mgl_label_ext(gr,'y','axis 2',0,-1.4,0.) call mgl_stem(gr,y2,'r')
Python
y1, y2 = mglData(50), mglData(50); y1.Modify("0.3*sin(2*pi*x)"); y2.Modify("0.5+0.3*cos(2*pi*x)"); gr.SetRanges(-1,1,-1,1); gr.SetOrigin(-1,-1); gr.Axis(); gr.Label("y","axis 1",0); gr.Plot(y1,"b"); gr.SetRanges(0,1,0,1); gr.SetOrigin(1,1); gr.Axis(); gr.Label("y","axis 2",0); gr.Stem(y2,"r");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of semi-log plot. 3D pdf
C++ code
mglData x(2000), y(2000); x.Modify("0.01/(x+10^(-5))"); y.Modify("sin(1/v)",x); gr->Axis(mglPoint(0.01,-1),mglPoint(1000,1),mglPoint(0.01,-1)); gr->Axis("lg(x)",0,0); gr->SetTicks('x',0); gr->Box(); gr->Plot(x,y,"b2"); gr->Axis(); gr->Grid("xy","g"); gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
MGL code
new x 2000 new y 2000 modify x '0.01/(x+10^(-5))' modify y 'sin(1/v)' x xrange 0.01 1000 origin 0.01 -1 0 xtick 0 axis 'lg(x)' '' '' plot x y 'b2' axis grid 'xy' 'g' xlabel 'x' 0 ylabel 'y = sin 1/x' 0 box
Pure C code
HMDT x = mgl_create_data_size(2000,1,1); HMDT y = mgl_create_data_size(2000,1,1); mgl_data_modify(x,"0.01/(x+10^(-5))",0); mgl_data_modify_vw(y,"sin(1/v)",x,0); mgl_set_axis(gr,0.01,-1.,0.,1000.,1.,0.,0.01,-1.,0.); mgl_set_func(gr,"lg(x)",0,0); mgl_set_ticks(gr,0.,-5.,-5.); mgl_box(gr,1); mgl_plot_xy(gr,x,y,"b2"); mgl_axis(gr,"xy"); mgl_axis_grid(gr,"xy","g"); mgl_label_ext(gr,'x',"x",0,-1.4,0); mgl_label_ext(gr,'y', "y = sin 1/x",0,-1.4,0); mgl_delete_data(x); mgl_delete_data(y);
Fortran code
integer x,y, mgl_create_data_size x = mgl_create_data_size(2000,1,1) y = mgl_create_data_size(2000,1,1) call mgl_data_modify(x,'0.01/(x+10^(-5))',0) call mgl_data_modify_vw(y,'sin(1/v)',x,x) call mgl_set_axis(gr,0.01,-1.,0.,1000.,1.,0.,0.01,-1.,0.) call mgl_set_func(gr,'lg(x)','','') call mgl_set_ticks(gr,0.,-5.,-5.) call mgl_box(gr,1) call mgl_plot_xy(gr,x,y,'b2') call mgl_axis(gr,'xy') call mgl_axis_grid(gr,'xy','g') call mgl_label_ext(gr,'x','x',0.,-1.4,0.) call mgl_label_ext(gr,'y', 'y = sin 1/x',0.,-1.4,0.) call mgl_delete_data(x) call mgl_delete_data(y)
Python
TO BE DONE
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of log-log plot. 3D pdf
C++ code
mglData x(100), y(100); x.Modify("pow(10,6*x-3)"); y.Modify("sqrt(1+v^2)",x); gr->Axis(mglPoint(0.001,0.1),mglPoint(1000,1000),mglPoint(0.001,0.1)); gr->Axis("lg(x)","lg(y)",0); gr->SetTicks('x',0); gr->SetTicks('y',0); gr->Box(); gr->Plot(x,y,"b2"); gr->Axis(); gr->Grid("xy","g;"); gr->Label('x',"x",0); gr->Label('y', "y=\\sqrt{1+x^2}",0);
MGL code
new x 100 new y 100 modify x 'pow(10,6*x-3)' modify y 'sqrt(1+v^2)' x axis 0.001 0.1 1000 1000 xtick 0 ytick 0 axis 'lg(x)' 'lg(y)' '' plot x y 'b2' axis grid 'xy' 'g;' xlabel 'x' 0 ylabel 'y=\sqrt{1+x^2}' 0 box
Pure C code
HMDT x = mgl_create_data_size(100,1,1); HMDT y = mgl_create_data_size(100,1,1); mgl_data_modify(x,"pow(10,6*x-3)",0); mgl_data_modify_vw(y,"sqrt(1+v^2)",x,0); mgl_set_axis(gr,0.001,0.1,0.,1000.,1000.,0.,0.001,0.1,0.); mgl_set_func(gr,"lg(x)","lg(y)",0); mgl_set_ticks(gr,0.,0.,-5.); mgl_box(gr,1); mgl_plot_xy(gr,x,y,"b2"); mgl_axis(gr,"xy"); mgl_axis_grid(gr,"xy","g;"); mgl_label_ext(gr,'x',"x",0,-1.4,0); mgl_label_ext(gr,'y', "y=\\sqrt{1+x^2}",0,-1.4,0); mgl_delete_data(x); mgl_delete_data(y);
Fortran code
integer x,y, mgl_create_data_size x = mgl_create_data_size(100,1,1) y = mgl_create_data_size(100,1,1) call mgl_data_modify(x,'pow(10,6*x-3)',0) call mgl_data_modify_vw(y,'sqrt(1+v^2)',x,x) call mgl_set_axis(gr,0.001,0.1,0.,1000.,1000.,0.,0.001,0.1,0.) call mgl_set_func(gr,'lg(x)','lg(y)','') call mgl_set_ticks(gr,0.,0.,-5.) call mgl_box(gr,1) call mgl_plot_xy(gr,x,y,'b2') call mgl_axis(gr,'xy') call mgl_axis_grid(gr,'xy','g;') call mgl_label_ext(gr,'x','x',0.,-1.4,0) call mgl_label_ext(gr,'y', 'y=\sqrt{1+x^2}',0.,-1.4,0) call mgl_delete_data(x) call mgl_delete_data(y)
Python
x, y = mglData(100), mglData(100); x.Modify("pow(10,6*x-3)"); y.Modify("sqrt(1+v^2)",x); gr.SetRanges(0.001,1000,0.1,1000); gr.SetOrigin(0.001,0.1); gr.SetFunc("lg(x)","lg(y)",""); gr.SetTicks("x",0); gr.SetTicks("y",0); gr.Box(); gr.Plot(x,y,"b2"); gr.Axis(); gr.Grid("xy","g;"); gr.Label("x","x",0); gr.Label("y","y=\\sqrt{1+x^2}",0);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of nonlinear fitting. 3D pdf
C++ code
mglData rnd(100), in(100), res; rnd.Fill("0.4*rnd+0.1+sin(2*pi*x)", gr->Min, gr->Max); in.Fill("0.3+sin(2*pi*x)", gr->Min, gr->Max); gr->Axis(mglPoint(-1,-2), mglPoint(1,2)); gr->Plot(rnd, ". "); gr->Box(); float ini[3] = {1,1,3}; gr->Fit(res, rnd, "a+b*sin(c*x)", "abc", ini); gr->Plot(res, "r"); gr->Plot(in, "b"); gr->Text(mglPoint(-1, -1.3), "fitted:", "L:r", -1); gr->PutsFit(mglPoint(0, -1.8), "y = ", "C:r", -1); gr->Text(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "C:b", -1);
MGL code
new rnd 100 fill rnd '0.4*rnd+0.1+sin(2*pi*x)' new in 100 fill in '0.3+sin(2*pi*x)' yrange -2 2 plot rnd '. ' box list ini 1 1 3 fit res rnd 'a+b*sin(c*x)' 'abc' ini plot res 'r' plot in 'b' text -1 -1.3 'fitted:' 'L:r' -1 putsfit 0 -1.8 'y = ' 'C:r' text 0 2.2 'initial: y = 0.3+sin(2\pi x)' 'C:b' -1
Pure C code
HMDT rnd,in,res; float ini[3] = {1,1,3}; rnd = mgl_create_data_size(100,1,1); in = mgl_create_data_size(100,1,1); res = mgl_create_data(); mgl_data_modify(rnd,"0.4*rnd+0.1+sin(4*pi*x)",0); mgl_data_modify(in,"0.3+sin(4*pi*x)",0); mgl_set_axis_2d(gr,-1.,-2.,1.,2.); mgl_plot(gr,rnd,". "); mgl_box(gr,1); mgl_fit_1(gr,res,rnd,"a+b*sin(c*x)","abc",ini); mgl_plot(gr,res,"r"); mgl_plot(gr,in,"b"); mgl_puts_ext(gr,-1.,-1.3,0.,"fitted:","L:r",-1.,'t'); mgl_puts_fit(gr,0.,-1.8,0.,"y = ","C:r",-1.); mgl_puts_ext(gr,0.,2.2,0.,"initial: y = 0.3+sin(2\\pi x)","C:b", -1., 't');
Fortran code
integer rnd,in,res, mgl_create_data_size real ini(3) ini(1)=1; ini(2)=1; ini(3)=3; rnd = mgl_create_data_size(100,1,1); in = mgl_create_data_size(100,1,1); res = mgl_create_data(); call mgl_data_modify(rnd,"0.4*rnd+0.1+sin(4*pi*x)",0); call mgl_data_modify(in,"0.3+sin(4*pi*x)",0); call mgl_set_axis_2d(gr,-1.,-2.,1.,2.); call mgl_plot(gr,rnd,". "); call mgl_box(gr,1); call mgl_fit_1(gr,res,rnd,"a+b*sin(c*x)","abc",ini); call mgl_plot(gr,res,"r"); call mgl_plot(gr,in,"b"); call mgl_puts_ext(gr,-1.,-1.3,0.,"fitted:","L:r",-1.,'t'); call mgl_puts_fit(gr,0.,-1.8,0.,"y = ","C:r",-1.); call mgl_puts_ext(gr,0.,2.2,0.,"initial: y = 0.3+sin(2\\pi x)","C:b", -1., 't');
Python
rnd, In, res, ini = mglData(100), mglData(100), mglData(), mglData(3); rnd.Modify("0.4*rnd+0.1+sin(4*pi*x)"); In.Modify("0.3+sin(4*pi*x)"); gr.SetRanges(-1,1,-2,2); gr.Plot(rnd,". "); gr.Box(); ini[0], ini[1], ini[2] = 1, 1, 3; gr.Fit(res,rnd,"a+b*sin(c*x)","abc",ini); gr.Plot(res,"r"); gr.Plot(In,"b"); gr.Puts(-1,-1.3,0,"fitted:","L:r",-1); gr.PutsFit(0,-1.8,0,"y = ","C:r",-1); gr.Puts(0,2.2,0,"initial: y = 0.3+sin(2\\pi x)","C:b",-1);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of envelop reconstruction.
C++ code
mglData a(1000); a.Fill("exp(-8*x^2)*sin(10*pi*x)", gr->Min, gr->Max); gr->Plot(a, "b"); a.Envelop('x'); gr->Plot(a, "r"); gr->Axis();
MGL code
new a 1000 fill a 'exp(-8*x^2)*sin(10*pi*x)' plot a 'b' envelop a plot a 'r' axis
Pure C code
HMDT a = mgl_create_data_size(1000,1,1); mgl_data_fill_eq(gr,a, "exp(-8*x^2)*sin(10*pi*x)", 0,0); mgl_plot(gr,a,"b"); mgl_data_envelop(a,'x'); mgl_plot(gr,a,"r"); mgl_axis(gr,"xyz");
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(1000,1,1) call mgl_data_fill_eq(gr,a, 'exp(-8*x^2)*sin(10*pi*x)', 0,0) call mgl_plot(gr,a,'b') call mgl_data_envelop(a,'x') call mgl_plot(gr,a,'r') call mgl_axis(gr,'xyz')
Python
a = mglData(1000); gr.Fill(a, "exp(-8*x^2)*sin(10*pi*x)"); gr.Plot(a,"b"); a.Envelop("x"); gr.Plot(a,"r"); gr.Axis();
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of phase “sewing”.
C++ code
mglData a(100, 100); a.Modify("mod((y^2-(1-x)^2)/2,0.1)"); gr->Rotate(40, 60); gr->Light(true); gr->Alpha(true); gr->Surf(a, "b"); a.Sew("xy", 0.1); gr->Surf(a, "r"); gr->Box();
MGL code
new a 100 100 modify a 'mod((y^2-(1-x)^2)/2,0.1)' rotate 40 60 light on alpha on surf a 'b' sew a 'xy' 0.1 surf a 'r' box
Pure C code
HMDT a = mgl_create_data_size(100,100,1); mgl_data_modify(a, "mod((y^2-(1-x)^2)/2, 0.1)", 0); mgl_rotate(gr,40.,60.,0.); mgl_set_light(gr,1); mgl_set_alpha(gr,1); mgl_surf(gr,a,"b"); mgl_data_sew(a,"xy",0.1); mgl_surf(gr,a,"r"); mgl_box(gr,1);
Fortran code
integer a, mgl_create_data_size a = mgl_create_data_size(100,100,1) call mgl_data_modify(a, 'mod((y^2-(1-x)^2)/2, 0.1)', 0) call mgl_rotate(gr,40.,60.,0.) call mgl_set_light(gr,1) call mgl_set_alpha(gr,1) call mgl_surf(gr,a,'b') call mgl_data_sew(a,'xy',0.1) call mgl_surf(gr,a,'r') call mgl_box(gr,1)
Python
a = mglData(100, 100); a.Modify("mod((y^2-(1-x)^2)/2, 0.1)"); gr.Rotate(40, 60); gr.Light(True); gr.Alpha(True); gr.Surf(a, "b"); a.Sew("xy", 0.1); gr.Surf(a, "r"); gr.Box();
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Short Time Fourier Analysis.
C++ code
mglData a(2000), b(2000); a.Fill("cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+ \ cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)", gr->Min, gr->Max); gr->SubPlot(1, 2, 0); gr->Plot(a); gr->Axis(); gr->Label('x', "\\i t"); gr->SubPlot(1, 2, 1); gr->STFA(a, b, 64); gr->Axis(); gr->Label('x', "\\i t"); gr->Label('y', "\\omega", 0);
MGL code
new a 2000 new b 2000 fill a 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+ cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)' subplot 1 2 0 plot a axis xlabel '\i t' subplot 1 2 1 stfa a b 64 '' axis ylabel '\omega' 0 xlabel '\i t'
Pure C code
HMDT a = mgl_create_data_size(2000,1,1); HMDT b = mgl_create_data_size(2000,1,1); mgl_data_fill_eq(gr, a, "cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+ \ cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)",0,0); mgl_subplot(gr,1,2,0); mgl_plot(gr,a,""); mgl_axis(gr,"xy"); mgl_label(gr,'x', "\\i t"); mgl_subplot(gr,1,2,1); mgl_stfa(gr,a,b,64,"",0.); mgl_axis(gr,"xy"); mgl_label(gr,'x', "\\i t"); mgl_label(gr,'y', "\\omega");
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(2000,1,1) b = mgl_create_data_size(2000,1,1) call mgl_data_fill_eq(gr, a, 'cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+ & cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)',0,0) call mgl_subplot(gr,1,2,0) call mgl_plot(gr,a,'') call mgl_axis(gr,'xy') call mgl_label(gr,'x', '\i t') call mgl_subplot(gr,1,2,1) call mgl_stfa(gr,a,b,64,'',0.) call mgl_axis(gr,'xy') call mgl_label(gr,'x', '\i t') call mgl_label(gr,'y', '\omega')
Python
a, b = mglData(2000), mglData(2000); gr.Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+ \ cos(200*pi*x)*(x<.5)*(x>0)+cos(400*pi*x)*(x>.5)"); gr.SubPlot(1, 2, 0); gr.Plot(a); gr.Axis(); gr.Label('x', "\\i t"); gr.SubPlot(1, 2, 1); gr.STFA(a, b, 64); gr.Axis(); gr.Label('x', "\\i t"); gr.Label('y', "\\omega", 0);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of Partial Differential Eduation solving.
C++ code
mglData a,re(128),im(128); gr->Axis(); gr->Label('x', "\\i x"); gr->Label('y', "\\i z"); re.Fill("exp(-48*(x+0.7)^2)", gr->Min, gr->Max); a = mglPDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, gr->Min, gr->Max, 0.01, 30); a.Transpose("yxz"); gr->CAxis(0, 1); gr->Dens(a,"wyrRk"); gr->Plot("-x", "k|"); gr->Puts(mglPoint(0, 0.85), "absorption: (x+z)/2 for x+z>0"); gr->Title("\\r{Equation:} ik_0\\partial_zu + \\Delta u + x\\cdot u + \ i \\frac{x+z}{2}\\cdot u = 0", "iC", -1.5);
MGL code
axis xlabel '\i x' ylabel '\i z' new re 128 new im 128 fill re 'exp(-48*(x+0.7)^2)' pde a 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)' re im 0.01 30 transpose a crange 0 1 dens a 'wyrRk' fplot '-x' 'k|' text 0 0.85 'absorption: (x+z)/2 for x+z>0' '' -1 title 'Equation: ik_0\partial_zu + \Delta u + x\cdot u + i \frac{x+z}{2}\cdot u = 0' 'iC' -1.5
Pure C code
HMDT a = mgl_create_data(); HMDT re = mgl_create_data_size(128,1,1); HMDT im = mgl_create_data_size(128,1,1); mgl_axis(gr,"xyz"); mgl_label(gr,'x', "\\i x"); mgl_label(gr,'y', "\\i z"); mgl_data_fill_eq(gr,re,"exp(-48*(x+0.7)^2)", 0, 0); a = mgl_pde_solve(gr, "p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30.); mgl_data_transpose(a, "yxz"); mgl_set_caxis(gr, 0, 1); mgl_dens(gr, a,"wyrRk", -1.); mgl_fplot(gr, "-x", "k|", 100); mgl_puts(gr, 0., 0.85, 0., "absorption: (x+z)/2 for x+z>0"); mgl_title(gr, "\\r{Equation:} ik_0\\partial_zu + \\Delta u + x\\cdot u + \ i \\frac{x+z}{2}\\cdot u = 0", "iC", -1.5); mgl_delete_data(a); mgl_delete_data(im); mgl_delete_data(re);
Fortran code
integer a,re,im, mgl_create_data_size a = mgl_create_data() re = mgl_create_data_size(128,1,1) im = mgl_create_data_size(128,1,1) call mgl_axis(gr,'xyz') call mgl_label(gr,'x', '\i x') call mgl_label(gr,'y', '\i z') call mgl_data_fill_eq(gr,re,'exp(-48*(x+0.7)^2)', 0, 0) a = mgl_pde_solve(gr, 'p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)', re, im, 0.01, 30.) call mgl_data_transpose(a, 'yxz') call mgl_set_caxis(gr, 0., 1.) call mgl_dens(gr, a,'wyrRk', -1.) call mgl_fplot(gr, '-x', 'k|', 100) call mgl_puts(gr, 0., 0.85, 0., 'absorption: (x+z)/2 for x+z>0') call mgl_title(gr, '\r{Equation:} ik_0\partial_zu + \Delta u + x\cdot u + & i \frac{x+z}{2}\cdot u = 0', 'iC', -1.5) call mgl_delete_data(a) call mgl_delete_data(im) call mgl_delete_data(re)
Python
a, re, im = mglData(), mglData(128), mglData(128); gr.Axis(); gr.Label('x', "\\i x"); gr.Label('y', "\\i z"); gr.Fill(re,"exp(-48*(x+0.7)^2)"); a = gr.PDE("p^2+q^2-x-1+i*0.5*(z+x)*(z>-x)", re, im, 0.01, 30); a.Transpose("yxz"); gr.SetCRange(0, 1); gr.Dens(a,"wyrRk"); gr.Plot("-x", "k|"); gr.Puts(0, 0.85, 0., "absorption: (x+z)/2 for x+z>0"); gr.Title("\\r{Equation:} ik_0\\partial_zu + \\Delta u + x\\cdot u + \ i \\frac{x+z}{2}\\cdot u = 0", "iC", -1.5);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of ray and beam tracing. Compare with PDE sample.
C++ code
mglData r, xx, yy, a, im(128), re(128); const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)"; r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2); gr->Plot(r.SubData(0), r.SubData(1), "k"); gr->Axis(); gr->Label('x', "\\i x"); gr->Label('y', "\\i z"); // now start beam tracing re.Fill("exp(-48*x^2)", gr->Min, gr->Max); a = mglQO2d(ham, re, im, r, 1, 30, &xx, &yy); gr->CAxis(0, 1); gr->Dens(xx, yy, a, "wyrRk"); gr->Plot("-x", "k|"); gr->Puts(mglPoint(0, 0.85), "absorption: (x+y)/2 for x+y>0"); gr->Puts(mglPoint(0.7, -0.05), "central ray"); gr->Title("Beam and ray tracing", "C", -1.5);
MGL code
define $1 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)' ray r $1 -0.7 -1 0 0 0.5 0 0.02 2 plot r(0) r(1) 'k' axis xlabel '\i x' ylabel '\i z' new re 128 new im 128 new xx new yy fill re 'exp(-48*x^2)' qo2d a $1 re im r 1 30 xx yy crange 0 1 dens xx yy a 'wyrRk' fplot '-x' 'k|' text -0.8 0.85 'absorption: (x+y)/2 for x+y>0' 'L' -1 text 0.5 -0.05 'central ray' 'L' -1 title 'Beam and ray tracing' 'C' -1.5
Pure C code
const char *ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)"; HMDT r, xx, yy, a, im, re; im = mgl_create_data_size(128,1,1); re = mgl_create_data_size(128,1,1); r = mgl_ray_trace(ham, -0.7, -1., 0., 0., 0.5, 0., 0.02, 2.); xx = mgl_data_subdata(r,0,-1,-1); yy = mgl_data_subdata(r,1,-1,-1); mgl_plot_xy(gr, xx, yy, "k"); mgl_axis(gr,"xyz"); mgl_label(gr,'x',"\\i x"); mgl_label(gr,'y',"\\i z"); mgl_data_fill_eq(gr,re,"exp(-48*x^2)", 0, 0); a = mgl_qo2d_solve(ham, re, im, r, 1, 30, xx, yy); mgl_set_caxis(gr,0.,1.); mgl_dens_xy(gr,xx, yy, a, "wyrRk", -1.); mgl_fplot(gr,"-x", "k|",100); mgl_puts(gr, 0., 0.85, 0., "absorption: (x+y)/2 for x+y>0"); mgl_puts(gr, 0.7, -0.05, 0., "central ray"); mgl_title(gr, "Beam and ray tracing", "C", -1.5); mgl_delete_data(a); mgl_delete_data(r); mgl_delete_data(xx); mgl_delete_data(yy); mgl_delete_data(im); mgl_delete_data(re);
Fortran code
integer r, xx, yy, a, im, re, mgl_create_data_size integer mgl_data_subdata, mgl_ray_trace, mgl_qo2d_solve character*64 ham ham = 'p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)' im = mgl_create_data_size(128,1,1) re = mgl_create_data_size(128,1,1) r = mgl_ray_trace(ham, -0.7, -1., 0., 0., 0.5, 0., 0.02, 2.) xx = mgl_data_subdata(r,0,-1,-1) yy = mgl_data_subdata(r,1,-1,-1) call mgl_plot_xy(gr, xx, yy, 'k') call mgl_axis(gr,'xyz') call mgl_label(gr,'x','\i x') call mgl_label(gr,'y','\i z') call mgl_data_fill_eq(gr,re,'exp(-48*x^2)', 0, 0) a = mgl_qo2d_solve(ham, re, im, r, 1., 30., xx, yy) call mgl_set_caxis(gr,0.,1.) call mgl_dens_xy(gr,xx, yy, a, 'wyrRk', -1.) call mgl_fplot(gr,'-x', 'k|',100) call mgl_puts(gr, 0., 0.85, 0., 'absorption: (x+y)/2 for x+y>0') call mgl_puts(gr, 0.7, -0.05, 0., 'central ray') call mgl_title(gr, 'Beam and ray tracing', 'C', -1.5) call mgl_delete_data(a) call mgl_delete_data(r) call mgl_delete_data(xx) call mgl_delete_data(yy) call mgl_delete_data(im) call mgl_delete_data(re)
Python
ham = "p^2+q^2-x-1+i*0.5*(y+x)*(y>-x)"; r, xx, yy, a = mglData(), mglData(), mglData(), mglData(); im, re = mglData(128), mglData(128); r = mglRay(ham, mglPoint(-0.7, -1), mglPoint(0, 0.5), 0.02, 2); gr.Plot(r.SubData(0), r.SubData(1), "k"); gr.Axis(); gr.Label('x', "\\i x"); gr.Label('y', "\\i z"); gr.Fill(re,"exp(-48*x^2)"); a = mglQO2d(ham, re, im, r, 1, 30, xx, yy); gr.SetCRange(0, 1); gr.Dens(xx, yy, a, "wyrRk"); gr.Plot("-x", "k|"); gr.Puts(0, 0.85, 0, "absorption: (x+y)/2 for x+y>0"); gr.Puts(0.7, -0.05, 0, "central ray"); gr.Title("Beam and ray tracing", "C", -1.5);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of MGL parsing.
C++ code
float a[100]; // let a_i = sin(4*pi*x), x=0...1 for(int i=0;i<100;i++) a[i]=sin(4*M_PI*i/99); mglParse *parser = new mglParse; mglData &d = (parser->AddVar("dat"))->d; d.Set(a,100); // set data to variable parser->Execute(gr, "plot dat; xrange 0 1\nbox\naxis"); // you may break script at any line do something // and continue after that parser->Execute(gr, "xlabel 'x'\nylabel 'y'\nbox"); // also you may use cycles or conditions in script parser->Execute(gr, "for $0 -1 1 0.1\nline 0 0 -1 $0 'r'\nnext");
MGL code
NOT AVAILABLE
Pure C code
float a[100]; /* let a_i = sin(4*pi*x), x=0...1 */ int i; for(i=0;i<100;i++) a[i]=sin(4*M_PI*i/99); HMPR parser = mgl_create_parser(); HMDT d = mgl_add_var(parser, "dat"); mgl_data_set_float(d,a,100,1,1); /* set data to variable */ mgl_parse_text(gr, parser, "plot dat; xrange 0 1\nbox\naxis"); /* you may break script at any line do something and continue after that */ mgl_parse_text(gr, parser, "xlabel 'x'\nylabel 'y'"); /* also you may use cycles or conditions in script */ mgl_parse_text(gr, parser, "for $0 -1 1 0.1\nline 0 0 -1 $0 'r'\nnext");
Fortran code
integer i,parser,d, mgl_create_data_size, mgl_create_parser real a(100) ! let a_i = sin(4*pi*x), x=0...1 do i = 1,100 a(i)=sin(4*3.1415926*(i-1)/99) end do parser = mgl_create_parser() d = mgl_add_var(parser, "dat") call mgl_data_set_real(d,a,100,1,1) ! set data to variable ! I don't know how put new line ('\n') into fortran string ! So call mgl_parse_text() for each string :( call mgl_parse_text(gr, parser, "plot dat; xrange 0 1") call mgl_parse_text(gr, parser, "box") call mgl_parse_text(gr, parser, "axis") ! you may break script at any line do something ! and continue after that call mgl_parse_text(gr, parser, "xlabel 'x'") call mgl_parse_text(gr, parser, "ylabel 'y'") ! there is now conditions because I don't know ! how to send several string into parser at once :( !! also you may use cycles or conditions in script !call mgl_parse_text(gr, parser, "for $0 -1 1 0.1\nline 0 0 -1 $0 'r'\nnext")
Python
You may need to use from numpy import *
for defining functions like sin()
.
parser = mglParse(); dat = parser.AddVar("dat"); dat.Create(100); for i in range(100): dat[i] = sin(4*pi*i/99); parser.Execute(gr, "plot dat; xrange 0 1\nbox\naxis"); # you may break script at any line do something # and continue after that parser.Execute(gr, "xlabel 'x'\nylabel 'y'"); # also you may use cycles or conditions in script parser.Execute(gr, "for $0 -1 1 0.1\nline 0 0 -1 $0 'r'\nnext");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of MGL parsing.
C++ code
gr->Axis(mglPoint(-M_PI, 0), mglPoint(M_PI, 2)); gr->SetTicksVal('x', 6, -M_PI, "-\\pi", -M_PI/2, "-\\pi/2", 0., "0", 0.886, "x^*", M_PI/2, "\\pi/2", M_PI, "\\pi"); gr->Axis(); gr->Grid(); gr->Plot("2*cos(x^2)^2", "r2", NAN, 300);
MGL code
axis -pi 0 pi 2 xtick -pi '-\pi' -1.571 '-\pi/2' 0 '0' 0.886 'x^*' 1.571 '\pi/2' pi '\pi' axis grid fplot '2*cos(x^2)^2' 'r2' nan 300
Pure C code
mgl_set_axis_2d(gr, -M_PI, 0, M_PI, 2); mgl_set_ticks_val(gr, 'x', 6, -M_PI, "-\\pi", -M_PI/2, "-\\pi/2", 0., "0", 0.886, "x^*", M_PI/2, "\\pi/2", M_PI, "\\pi"); mgl_axis(gr,"xyz"); mgl_axis_grid(gr,"xyz", "B-"); mgl_fplot(gr, "2*cos(x^2)^2", "r2", 300);
Fortran code
NOT AVAILABLE
Python
gr.SetRanges(-pi, pi, 0, 2); parser = mglParse(); # very "stupid" way because SWIG not support variable arguments parser.Execute(gr, "xtick -pi '-\pi' -1.571 '-\pi/2' 0 '0' " "0.886 'x^*' 1.571 '\pi/2' pi '\pi'"); gr.Axis(); gr.Grid(); gr.Plot("2*cos(x^2)^2", "r2", 300);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Example of MGL parsing.
C++ code
char str[32]; for(int i=0;i<4;i++) { gr->ColumnPlot(4,i); gr->Box(); sprintf(str,"Plot %d of 4",i); gr->Text(mglPoint(-0.5,0.5),str); sprintf(str,"sin(pi*x+pi*%d/2)",i); gr->Plot(str); }
MGL code
for $1 0 3 columnplot 4 $1 box text -0.5 0.5 'Plot $1 of 4' fplot 'sin(pi*x+pi*$1/2)' next
Pure C code
int i; char str[32]; for(i=0;i<4;i++) { mgl_columnplot(gr,4,i); mgl_box(gr,1); sprintf(str,"Plot %d of 4",i); mgl_text(gr,-0.5,0.5,0.,str); sprintf(str,"sin(pi*x+pi*%d/2)",i); mgl_fplot(gr,str,"",100); }
Fortran code
NOT AVAILABLE
Python
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January, 16 2010 using texi2html 1.78.