Next: , Previous: , Up: 1D samples   [Contents][Index]


3.5.22 Tape sample

Function tape draw tapes which rotate around the curve as normal and binormal. The sample code is:

int sample(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);
  gr->SubPlot(2,2,0,"");  gr->Title("Tape plot (default)");
  gr->Box();  gr->Tape(y);  gr->Plot(y,"k");

  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#");
  return 0;
}
Example of Tape()