Esempio n. 1
0
def plot(bzs):
    tocubic.plot_prolog()
    print('/ss 1.5 def')
    print(
        '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    )
    fromcubic.plot_bzs(bzs, (100, 100), 0.25, fancy=True)
    print('showpage')
Esempio n. 2
0
def simple_bez():
    eps_prologue(95, 126, 552, 508, 0)
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 1.1, 2)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    print '/Times-Roman 12 selectfont'
    print '95 130 moveto ((x0, y0)) show'
    print '360 200 moveto ((x1, y1)) show'
    print '480 340 moveto ((x2, y2)) show'
    print '505 495 moveto ((x3, y3)) show'
    print 'showpage'
    eps_trailer()
Esempio n. 3
0
def simple_bez():
    eps_prologue(95, 126, 552, 508, 0)
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 1.1, 2)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    print '/Times-Roman 12 selectfont'
    print '95 130 moveto ((x0, y0)) show'
    print '360 200 moveto ((x1, y1)) show'
    print '480 340 moveto ((x2, y2)) show'
    print '505 495 moveto ((x3, y3)) show'
    print 'showpage'
    eps_trailer()
Esempio n. 4
0
def fast_bez(figno):
    if figno == 3:
        y1 = 520
    else:
        y1 = 550
    eps_prologue(95, 140, 552, y1, 0)
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 1.1, figno)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    plot_k_nominal(.5, 1.1)
    plot_k_of_bz(bz)
    print 'showpage'
    eps_trailer()
Esempio n. 5
0
def fast_bez(figno):
    if figno == 3:
        y1 = 520
    else:
        y1 = 550
    eps_prologue(95, 140, 552, y1, 0)
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 1.1, figno)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    plot_k_nominal(.5, 1.1)
    plot_k_of_bz(bz)
    print 'showpage'
    eps_trailer()
Esempio n. 6
0
def bezfig(s1):
    eps_prologue(95, 38, 510, 550, 0)
    #print '0.5 0.5 scale 500 100 translate'
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 0.85, 1)
    fromcubic.plot_bzs([[bz]], (-400, 0), 1000, True)
    print 'stroke'
    plot_k_nominal(.5, 0.85)
    plot_k_of_bz(bz)
    bz, score = cornu_to_cubic(.5, 0.85, 2)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    print 'gsave 0 50 translate'
    plot_k_nominal(.5, .85)
    plot_k_of_bz(bz)
    print 'grestore'
    print 'showpage'
Esempio n. 7
0
def plot_tt(bzs, orig = None, style = 'redcyan'):
	tocubic.plot_prolog()
	print '/ss 2 def'
	print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
	if style == 'redcyan':
		print 'true setoverprint true setoverprintmode'
	x0 = 100
	y0 = 100
	scale = 0.25
	if orig:
		print '0 1 1 0 setcmykcolor'
		fancy = (style == 'redcyan')
		plot_tt_raw(orig, fancy)
	if style == 'redcyan':
		print '1 0 0 0 setcmykcolor'
	elif style == 'redblack':
		print '0 0 0 1 setcmykcolor'
	plot_tt_raw(bzs)
	print 'showpage'
Esempio n. 8
0
def bezfig(s1):
    eps_prologue(95, 38, 510, 550, 0)
    #print '0.5 0.5 scale 500 100 translate'
    tocubic.plot_prolog()
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    bz, score = cornu_to_cubic(.5, 0.85, 1)
    fromcubic.plot_bzs([[bz]], (-400, 0), 1000, True)
    print 'stroke'
    plot_k_nominal(.5, 0.85)
    plot_k_of_bz(bz)
    bz, score = cornu_to_cubic(.5, 0.85, 2)
    fromcubic.plot_bzs([[bz]], (-400, 100), 1000, True)
    print 'stroke'
    print 'gsave 0 50 translate'
    plot_k_nominal(.5, .85)
    plot_k_of_bz(bz)
    print 'grestore'
    print 'showpage'
Esempio n. 9
0
def plot_tt(bzs, orig = None, style = 'redcyan'):
	tocubic.plot_prolog()
	print '/ss 2 def'
	print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
	if style == 'redcyan':
		print 'true setoverprint true setoverprintmode'
	x0 = 100
	y0 = 100
	scale = 0.25
	if orig:
		print '0 1 1 0 setcmykcolor'
		fancy = (style == 'redcyan')
		plot_tt_raw(orig, fancy)
	if style == 'redcyan':
		print '1 0 0 0 setcmykcolor'
	elif style == 'redblack':
		print '0 0 0 1 setcmykcolor'
	plot_tt_raw(bzs)
	print 'showpage'
Esempio n. 10
0
def test_to_pcorn():
    C1 = 0.55228
    bz = [(100, 100), (100 + 400 * C1, 100), (500, 500 - 400 * C1), (500, 500)]
    for i in range(0, 13):
        thresh = .1 ** i
        segs = cubic_bz_to_pcorn(bz, thresh)
        plot_segs(segs)
        print >> sys.stderr, thresh, len(segs)
        print '0 20 translate'

if __name__ == '__main__':
    f = file(sys.argv[1])
    bzs = read_bz(f)
    rsps = bzs_to_pcorn(bzs, 1)
    #print rsps
    tocubic.plot_prolog()
    print 'grestore'
    print '1 -1 scale 0 -720 translate'
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    tot = 0
    for segs in rsps:
        curve = pcorn.Curve(segs)
        #curve = offset.offset(curve, 10)
        print '%', curve.arclen
        print '%', curve.sstarts
        if 0:
            print 'gsave 1 0 0 setrgbcolor'
            cmd = 'moveto'
            for i in range(100):
                s = i * .01 * curve.arclen
Esempio n. 11
0
def plot(bzs):
	tocubic.plot_prolog()
	print '/ss 1.5 def'
	print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
	fromcubic.plot_bzs(bzs, (100, 100), 0.25, fancy = True)
	print 'showpage'
Esempio n. 12
0
    C1 = 0.55228
    bz = [(100, 100), (100 + 400 * C1, 100), (500, 500 - 400 * C1), (500, 500)]
    for i in range(0, 13):
        thresh = .1**i
        segs = cubic_bz_to_pcorn(bz, thresh)
        plot_segs(segs)
        print >> sys.stderr, thresh, len(segs)
        print '0 20 translate'


if __name__ == '__main__':
    f = file(sys.argv[1])
    bzs = read_bz(f)
    rsps = bzs_to_pcorn(bzs, 1)
    #print rsps
    tocubic.plot_prolog()
    print 'grestore'
    print '1 -1 scale 0 -720 translate'
    print '/ss 1.5 def'
    print '/circle { ss 0 moveto currentpoint exch ss sub exch ss 0 360 arc } bind def'
    tot = 0
    for segs in rsps:
        curve = pcorn.Curve(segs)
        #curve = offset.offset(curve, 10)
        print '%', curve.arclen
        print '%', curve.sstarts
        if 0:
            print 'gsave 1 0 0 setrgbcolor'
            cmd = 'moveto'
            for i in range(100):
                s = i * .01 * curve.arclen