| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.3.11 CutOff sample
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);
