[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.4.18 Pipe 3D sample
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");