def checkone(knots, refpoints): # <<< print(myprint(knots)) mp_make_choices(knots, epsilon) print(myprint(knots)) c = canvas.canvas() c.stroke(mypath(knots), [deco.shownormpath(), deco.earrow.normal]) c.writePDFfile(bboxenlarge=unit.t_cm) c.writeEPSfile(bboxenlarge=unit.t_cm) c.writeSVGfile(bboxenlarge=unit.t_cm) check(knots, refpoints)
def checkall(): # <<< c = None for knots, refpoints in [curve1(), curve2(), curve3(), curve4(-90), curve4(0), curve4(70), curve5(), curve6a(), curve6b(), curve6c(), curve7(), curve8a(), curve8b(), curve9(), curve10()]: #print myprint(knots) mp_make_choices(knots, epsilon) #print myprint(knots) cc = canvas.canvas() cc.stroke(mypath(knots), [deco.shownormpath(), deco.earrow.normal]) if c is None: c = canvas.canvas() c.insert(cc) else: c.insert(cc, [trafo.translate(0, c.bbox().bottom() - cc.bbox().top()-0.5)]) check(knots, refpoints) c.writePDFfile() c.writeEPSfile() c.writeSVGfile()
def checkall(): # <<< c = None for knots, refpoints in [ curve1(), curve2(), curve3(), curve4(-90), curve4(0), curve4(70), curve5(), curve6a(), curve6b(), curve6c(), curve7(), curve8a(), curve8b(), curve9(), curve10() ]: #print myprint(knots) mp_make_choices(knots, epsilon) #print myprint(knots) cc = canvas.canvas() cc.stroke(mypath(knots), [deco.shownormpath(), deco.earrow.normal]) if c is None: c = canvas.canvas() c.insert(cc) else: c.insert(cc, [ trafo.translate(0, c.bbox().bottom() - cc.bbox().top() - 0.5) ]) check(knots, refpoints) c.writePDFfile() c.writeEPSfile() c.writeSVGfile()
def interface(): # <<< c = None for p in [ # ordinary open path: mppath.path([beginknot(0,0), curve(), knot(6,4), curve(), knot(4,9), curve(), knot(1,7), curve(), endknot(3,5)], epsilon), # path containing two open subpaths: mppath.path([beginknot(0,0), curve(), endknot(6,4), beginknot(4,9), curve(), knot(1,7), curve(), endknot(3,5)], epsilon), # closed path: mppath.path([knot(0,0), curve(), knot(6,4), curve(), knot(4,9), curve(), knot(1,7), curve(), knot(3,5), curve()], epsilon), # open path, but with endpoints in the middle: mppath.path([knot(0,0), curve(), knot(6,4), curve(), endknot(4,9), beginknot(1,7), curve(), knot(3,5), curve()], epsilon), # the same path in the right order mppath.path([beginknot(1,7), curve(), knot(3,5), curve(), knot(0,0), curve(), knot(6,4), curve(), endknot(4,9)], epsilon), # include a line mppath.path([knot(0,0), curve(), knot(6,4), curve(), roughknot(4,9), line(), roughknot(1,7), curve(), knot(3,5), curve()], epsilon), # XXX the endpoints have "open" at their other sides, not "curl" as in the open example above mppath.path([knot(0,0), curve(), knot(6,4), curve(), knot(4,9), line(), knot(1,7), curve(), knot(3,5), curve()], epsilon), mppath.path([knot(0,0), curve(), knot(6,4), line(), knot(3,5), curve()], epsilon), mppath.path([knot(0,0), curve(), knot(6,4), curve(), knot(3,5), curve()], epsilon), # TODO the internal mp_make_choices treats this as closed, but the last curve is not plotted: mppath.path([knot(0,0), curve(), knot(6,4), curve(), knot(4,9), line(), knot(1,7), curve(), knot(3,5)], epsilon), # include a line with given angles mppath.path([knot(0,0), curve(), knot(6,4), curve(), knot(4,9), line(keepangles=True), knot(1,7), curve(), knot(3,5), curve()], epsilon), # include rough knots mppath.path([beginknot(0,0), curve(), roughknot(6,4,langle=90), curve(), roughknot(4,9,langle=-90), line(keepangles=True), roughknot(1,7,lcurl=3), curve(), endknot(3,5,angle=0)], epsilon), ]: cc = canvas.canvas() cc.stroke(p, [deco.shownormpath(), deco.earrow.normal]) if c is None: c = cc else: c.insert(cc, [trafo.translate(c.bbox().right() - cc.bbox().left() + 0.5, 0)]) c.writePDFfile() c.writeEPSfile() c.writeSVGfile()
def interface(): # <<< c = None for p in [ # ordinary open path: mppath.path([ beginknot(0, 0), curve(), knot(6, 4), curve(), knot(4, 9), curve(), knot(1, 7), curve(), endknot(3, 5) ], epsilon), # path containing two open subpaths: mppath.path([ beginknot(0, 0), curve(), endknot(6, 4), beginknot(4, 9), curve(), knot(1, 7), curve(), endknot(3, 5) ], epsilon), # closed path: mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), knot(4, 9), curve(), knot(1, 7), curve(), knot(3, 5), curve() ], epsilon), # open path, but with endpoints in the middle: mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), endknot(4, 9), beginknot(1, 7), curve(), knot(3, 5), curve() ], epsilon), # the same path in the right order mppath.path([ beginknot(1, 7), curve(), knot(3, 5), curve(), knot(0, 0), curve(), knot(6, 4), curve(), endknot(4, 9) ], epsilon), # include a line mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), roughknot(4, 9), line(), roughknot(1, 7), curve(), knot(3, 5), curve() ], epsilon), # XXX the endpoints have "open" at their other sides, not "curl" as in the open example above mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), knot(4, 9), line(), knot(1, 7), curve(), knot(3, 5), curve() ], epsilon), mppath.path( [knot(0, 0), curve(), knot(6, 4), line(), knot(3, 5), curve()], epsilon), mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), knot(3, 5), curve() ], epsilon), # TODO the internal mp_make_choices treats this as closed, but the last curve is not plotted: mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), knot(4, 9), line(), knot(1, 7), curve(), knot(3, 5) ], epsilon), # include a line with given angles mppath.path([ knot(0, 0), curve(), knot(6, 4), curve(), knot(4, 9), line(keepangles=True), knot(1, 7), curve(), knot(3, 5), curve() ], epsilon), # include rough knots mppath.path([ beginknot(0, 0), curve(), roughknot(6, 4, langle=90), curve(), roughknot(4, 9, langle=-90), line(keepangles=True), roughknot(1, 7, lcurl=3), curve(), endknot(3, 5, angle=0) ], epsilon), ]: cc = canvas.canvas() cc.stroke(p, [deco.shownormpath(), deco.earrow.normal]) if c is None: c = cc else: c.insert(cc, [ trafo.translate(c.bbox().right() - cc.bbox().left() + 0.5, 0) ]) c.writePDFfile() c.writeEPSfile() c.writeSVGfile()