def mecplots():
    print '2 dup scale'
    print '-153 -296 translate'
    scale = 45
    print '0.25 setlinewidth'
    print 306 - scale * pi/2, 396, 'moveto', 306 + scale * pi/2, 396, 'lineto stroke'
    print 306, 396 - scale * pi/2, 'moveto', 306, 396 + scale * pi/2, 'lineto stroke'
    print '/ss .5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'

    tic = .1
    maj = 5
    r0, r1 = 0, 81

    for i in range(r0, r1, maj):
        sm = i * tic
        cmd = 'moveto'
        for j in range(i, r1):
            sp = j * tic + 1e-3
            th0, th1 = trymec(sm, sp)
            print '%', sm, sp, th0, th1
            print 306 + scale * th0, 396 + scale * th1, cmd
            cmd = 'lineto'
        print 'stroke'
    for j in range(r0, r1, maj):
        sp = j * tic + 1e-3
        cmd = 'moveto'
        for i in range(0, j + 1):
            sm = i * tic
            th0, th1 = trymec(sm, sp)
            print '%', sm, sp, th0, th1
            print 306 + scale * th0, 396 + scale * th1, cmd
            cmd = 'lineto'
        print 'stroke'

    for i in range(r0, r1, maj):
        sm = i * tic
        for j in range(i, r1, maj):
            sp = j * tic + 1e-3
            th0, th1 = trymec(sm, sp)
            print 'gsave'
            print 306 + scale * th0, 596 + scale * th1, 'translate'
            print 'circle fill'
            uscale = 3
            xys, thm, cost = run_elastica_half(abs(sm), 0, 1, 0, 100)
            x0, y0 = xys[-1][0], xys[-1][1]
            if sm < 0:
                x0, y0 = -x0, -y0
            xys, thm, cost = run_elastica_half(abs(sp), 0, 1, 0, 100)
            x1, y1 = xys[-1][0], xys[-1][1]
            if sp < 0:
                x1, y1 = -x1, -y1
            cmd = 'moveto'
            for xy in xys:
                print xy[0] * uscale, xy[1] * uscale, cmd
                cmd = 'lineto'
            print 'stroke'
            print '1 0 0 setrgbcolor'
            print x0 * uscale, y0 * uscale, 'moveto'
            print x1 * uscale, y1 * uscale, 'lineto stroke'
            print 'grestore'

    print 'showpage'
dataset/ETHPy150Open google/roboto/third_party/spiro/curves/mecsolve.py/mecplots/original