Function tape draw tapes which rotate around the curve as transverse orts of accompanied coordinates.
MGL code:
call 'prepare1d' new yc 50 'sin(pi*x)':new xc 50 'cos(pi*x)':new z 50 'x' subplot 2 2 0 '':title 'Tape plot (default)':box:tape y:plot y 'k' subplot 2 2 1:title '3d variant, 2 colors':rotate 50 60:light on box:plot xc yc z 'k':tape xc yc z 'rg' subplot 2 2 2:title '3d variant, x only':rotate 50 60 box:plot xc yc z 'k':tape xc yc z 'xr':tape xc yc z 'xr#' subplot 2 2 3:title '3d variant, z only':rotate 50 60 box:plot xc yc z 'k':tape xc yc z 'zg':tape xc yc z 'zg#'
C++ code:
void smgl_tape(mglGraph *gr) { mglData y; mgls_prepare1d(&y); mglData xc(50), yc(50), z(50); yc.Modify("sin(pi*(2*x-1))"); xc.Modify("cos(pi*2*x-pi)"); z.Fill(-1,1); if(big!=3) { gr->SubPlot(2,2,0,""); gr->Title("Tape plot (default)"); } gr->Box(); gr->Tape(y); gr->Plot(y,"k"); if(big==3) return; gr->SubPlot(2,2,1); gr->Title("3d variant, 2 colors"); gr->Rotate(50,60); gr->Light(true); gr->Box(); gr->Plot(xc,yc,z,"k"); gr->Tape(xc,yc,z,"rg"); gr->SubPlot(2,2,2); gr->Title("3d variant, x only"); gr->Rotate(50,60); gr->Box(); gr->Plot(xc,yc,z,"k"); gr->Tape(xc,yc,z,"xr"); gr->Tape(xc,yc,z,"xr#"); gr->SubPlot(2,2,3); gr->Title("3d variant, z only"); gr->Rotate(50,60); gr->Box(); gr->Plot(xc,yc,z,"k"); gr->Tape(xc,yc,z,"zg"); gr->Tape(xc,yc,z,"zg#"); }