## Re: [PyX-user] transforms during path construction?

 Re: [PyX-user] transforms during path construction? From: Michael J Gruber - 2009-10-14 10:23:21 ```Alan G Isaac venit, vidit, dixit 13.10.2009 21:09: > What is the PyX equivalent to the following? > > 288 360 moveto > 4 {144 0 rlineto 72 rotate} repeat closepath stroke > How about unit.set(defaultunit="pt") c = canvas.canvas([style.linewidth(1)]) x,y = 144,0 p = path.path(path.moveto(0,0)) for i in range(4): p.append(path.rlineto(x,y)) x,y = trafo.rotate(72).apply(x,y) p.append(path.closepath()) c.stroke(p, [trafo.translate(288,360)]) This results in 288 360 moveto 432 360 lineto 476.498 496.952 lineto 360 581.593 lineto 243.502 496.952 lineto closepath stroke for the ps (besides gsave and such). Using PyX-trafos on points is the closest you get to PS's rotated coordinate system, and there's no way to create a "repeat" or "rlineto". Of course you could do things differently in PyX, such as rotating a path.line around and joining those rather than appending path elements: unit.set(defaultunit="pt") c = canvas.canvas([style.linewidth(1)]) pl = path.line(0,0,144,0) p = path.path(path.moveto(0,0)) x0,y0 = 0,0 for i in range(4): p = p << pl x,y = p.atend() pl = pl.transformed(trafo.rotate(72, x=x, y=y)*trafo.translate(x-x0, y-y0)) x0, y0 = x,y p.append(path.closepath()) c.stroke(p, [trafo.translate(288,360)]) Cheers, Michael ```