def mecchord():
    x0 = 72
    y0 = 72
    thscale = 150
    chscale = 400
    print '.5 setlinewidth'
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    draw_axes(x0, y0, thscale, chscale, 3.2, 1, 16, 10)
    print x0 + 1 * thscale, y0 - 28, 'moveto (angle) show'
    print 'gsave', x0 - 32, y0 + .25 * chscale, 'translate'
    print '90 rotate 0 0 moveto (chordlen / arclen) show'
    print 'grestore'

    cmd = 'moveto'
    for i in range(0, 67):
        s = i * .01
        xys, cost, x, y, th = run_elastica(-s, s, 4, 0, -8, 100)
        #plot(xys)
        if s > 0:
            ch = hypot(x, y) / (2 * s)
        else:
            ch = 1
        print '%', s, x, y, th, ch
        print x0 + thscale * th / 2, y0 + ch * chscale, cmd
        cmd = 'lineto'
    print 'stroke'

    print 'gsave %g %g translate circle fill' % (x0 + thscale * th / 2, y0 + ch * chscale)
    print '-30 15 translate 0.25 dup scale'
    print '-306 -396 translate'
    print '2 setlinewidth'
    plot(xys)
    print 'grestore'

    print 'gsave [2] 0 setdash'
    cmd = 'moveto'
    for i in range(0, 151):
        th = pi * i / 150.
        if 0 > th:
            ch = sin(th) / th
        else:
            ch = 1
        print x0 + thscale * th, y0 + ch * chscale, cmd
        cmd = 'lineto'
    print 'stroke'
    print 'grestore'

    k0 = 4 * .4536 / (2 / pi)
    s = pi / (2 * k0)
    xys, cost, x, y, th = run_elastica(-s, s, k0, 0, 0, 100)
    th = pi
    ch = 2 / pi
    print 'gsave %g %g translate circle fill' % (x0 + thscale * th / 2, y0 + ch * chscale)
    print '30 15 translate 0.25 dup scale'
    print '-306 -396 translate'
    print '2 setlinewidth'
    plot(xys)
    print 'grestore'

    print x0 + 1.25 * thscale, y0 + .55 * chscale, 'moveto (MEC) show'
    print x0 + 2.3 * thscale, y0 + .35 * chscale, 'moveto (SIMEC) show'

    print 'showpage'
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/mecsolve.py/mecchord/swapped operands of `>`