[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.6.11 Drops sample

C++ code
gr->Light(true); gr->Puts(mglPoint(-1,1.2),"sh=0"); gr->Drop(mglPoint(-1,0),mglPoint(0,1),0.5,"r",0); gr->Puts(mglPoint(-0.33,1.2),"sh=0.33"); gr->Drop(mglPoint(-0.33,0),mglPoint(0,1),0.5,"r",0.33); gr->Puts(mglPoint(0.33,1.2),"sh=0.67"); gr->Drop(mglPoint(0.33,0),mglPoint(0,1),0.5,"r",0.67); gr->Puts(mglPoint(1,1.2),"sh=1"); gr->Drop(mglPoint(1,0),mglPoint(0,1),0.5,"r",1); gr->Ball(mglPoint(-1,0,1),'k'); gr->Ball(mglPoint(-0.33,0,1),'k'); gr->Ball(mglPoint(0.33,0,1),'k'); gr->Ball(mglPoint(1,0,1),'k'); gr->Line(mglPoint(-1,0,1),mglPoint(1,0,1),"b");
MGL code
light on text -1 1.2 'sh=0' drop -1 0 0 1 0.5 'r' 0 text -0.33 1.2 'sh=0.33' drop -0.33 0 0 1 0.5 'r' 0.33 text 0.33 1.2 'sh=0.67' drop 0.33 0 0 1 0.5 'r' 0.67 text 1 1.2 'sh=1' drop 1 0 0 1 0.5 'r' 1 ball -1 0 1 'k' ball -0.33 0 1 'k' ball 0.33 0 1 'k' ball 1 0 1 'k' line -1 0 1 1 0 1 'b' new h 100 modify h '0.25*(1+x)^2' plot h 'k|' text -1 0.6 'h\sim(1+sh)^2' 'rL'
Pure C code
mgl_set_light(gr,1); mgl_puts(gr,-1.,1.2,0.,"sh=0"); mgl_drop(gr,-1.,0.,0.,0.,1.,0.,0.5,"r",0.,1.); mgl_puts(gr,-0.33,1.2,0.,"sh=0.33"); mgl_drop(gr,-0.33,0.,0.,0.,1.,0.,0.5,"r",0.33,1.); mgl_puts(gr,0.33,1.2,0.,"sh=0.67"); mgl_drop(gr,0.33,0.,0.,0.,1.,0.,0.5,"r",0.67,1.); mgl_puts(gr,1.,1.2,0.,"sh=1"); mgl_drop(gr,1.,0.,0.,0.,1.,0.,0.5,"r",1.,1.); mgl_ball_str(gr,-1.,0.,1.,"k"); mgl_ball_str(gr,-0.33,0.,1.,"k"); mgl_ball_str(gr,0.33,0.,1.,"k"); mgl_ball_str(gr,1.,0.,1.,"k"); mgl_line(gr,-1.,0.,1.,1.,0.,1.,"b",2);
Fortran code
call mgl_set_light(gr,1); call mgl_puts(gr,-1.,1.2,0.,"sh=0"); call mgl_drop(gr,-1.,0.,0.,0.,1.,0.,0.5,"r",0.,1.); call mgl_puts(gr,-0.33,1.2,0.,"sh=0.33"); call mgl_drop(gr,-0.33,0.,0.,0.,1.,0.,0.5,"r",0.33,1.); call mgl_puts(gr,0.33,1.2,0.,"sh=0.67"); call mgl_drop(gr,0.33,0.,0.,0.,1.,0.,0.5,"r",0.67,1.); call mgl_puts(gr,1.,1.2,0.,"sh=1"); call mgl_drop(gr,1.,0.,0.,0.,1.,0.,0.5,"r",1.,1.); call mgl_ball_str(gr,-1.,0.,1.,"k"); call mgl_ball_str(gr,-0.33,0.,1.,"k"); call mgl_ball_str(gr,0.33,0.,1.,"k"); call mgl_ball_str(gr,1.,0.,1.,"k"); call mgl_line(gr,-1.,0.,1.,1.,0.,1.,"b",2);
Python
gr.Light(True); gr.Puts(-1,1.2,0,"sh=0","rC"); gr.Drop(-1,0,0,0,1,0,0.5,"r",0); gr.Puts(-0.33,1.2,0,"sh=0.33","rC"); gr.Drop(-0.33,0,0,0,1,0,0.5,"r",0.33); gr.Puts(0.33,1.2,0,"sh=0.67","rC"); gr.Drop(0.33,0,0,0,1,0,0.5,"r",0.67); gr.Puts(1,1.2,0,"sh=1","rC"); gr.Drop(1,0,0,0,1,0,0.5,"r",1); gr.Ball(-1,0,1,"k"); gr.Ball(-0.33,0,1,"k"); gr.Ball(0.33,0,1,"k"); gr.Ball(1,0,1,"k"); gr.Line(-1,0,1,1,0,1,"b");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |