def curve(self, *points): """Add a Bezier curve from self.pos to points[-1] every other points are the control points of the Bezier curve (which will thus be of degree len(points) ) """ assert len(points) == 3 points = [rotate(p, self.theta) for p in points] self.svg.append('C %s,%s %s,%s %s,%s' % tuple(itertools.chain(*points))) self.pos = points[-1]
def arc(self, p, r, sweep): p = rotate(p, self.theta) self.svg.append('A %s,%s 0,0,%s %s,%s' % (r, r, str(sweep), p[0], p[1])) self.pos = p
def line(self, p): p = rotate(p, self.theta) self.svg.append('L %s,%s' % (p[0], p[1])) self.pos = p