contour
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

multiloop.mp
text/plain

Download raw (735 bytes)

def insertloop(expr p, t, height) =
  subpath(0, (t - .015) * length p) of p .. loop(p, t * length p, height) .. subpath((t + .015) * length p, length p) of p enddef;

def loopbase(expr p, t) = point t of p enddef;

def looptop(expr start, a, height) = (0, height) rotated a shifted start enddef;

def loop(expr p, t, h) =
  loopbase(p, t) ... {direction t of p rotated 180}looptop(loopbase(p, t), angle direction t of p, h) ... loopbase(p,t)
enddef;

beginfig(1);
  path p, l, ll, lll;
  height = 40mm;
  p = (0,0) -- (-100mm, 150mm);
  l = point 0 of p .. loop(p, .35, height) .. loop(p, .5, -height) .. loop(p, .65, height) .. point 1 of p;

  t = .178 * length l;

  draw insertloop(insertloop(l, .57, -15mm), .5, -4mm);


endfig;