manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1.13 Region sample

../png/region

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");

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.