2
from pyx.metapost.path import beginknot, endknot, smoothknot, tensioncurve
4
p1, p2, p3, p4, p5 = (0, 0), (2, 1.33), (1.3, 3), (0.33, 2.33), (1, 1.67)
5
openpath = metapost.path.path([
6
beginknot(*p1), tensioncurve(), smoothknot(*p2), tensioncurve(),
7
smoothknot(*p3), tensioncurve(), smoothknot(*p4), tensioncurve(),
9
closedpath = metapost.path.path([
10
smoothknot(*p1), tensioncurve(), smoothknot(*p2), tensioncurve(),
11
smoothknot(*p3), tensioncurve(), smoothknot(*p4), tensioncurve(),
12
smoothknot(*p5), tensioncurve()])
14
for p in [p1, p2, p3, p4, p5]:
15
c.fill(path.circle(p[0], p[1], 0.05), [color.rgb.red])
16
c.fill(path.circle(p[0], p[1], 0.05), [color.rgb.red, trafo.translate(2, 0)])
18
c.stroke(closedpath, [trafo.translate(2, 0)])
20
c.writeEPSfile("metapost")
21
c.writePDFfile("metapost")