[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.1.21 Torus sample
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");