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

9.4.13 Surf3A sample

../png/surf3a

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

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