From: Gary <pajer@in...>  20060226 18:28:49

Michael Schindler wrote: >Hello Gary, > >On 26.02.06, Gary wrote: > > >>Consider the script below. I expected the second line, the one to >>x1,y1, to hit the circle due west of center. When I run the script, the >>end of the line is far above the circle. >> >>What am I misunderstanding? >> >>Also, let me know if there is a more elegant syntax. >> >>thanks, >>gary >> >> >>from pyx import * >>from math import pi >> >>c = canvas.canvas() >> >>circle = path.circle(2,2,.2) >> >>x, y = circle.at(0.) >>x1, y1 = circle.at(pi) >> >> > >The circle is a general path at this point, thus not parameterised by >an angle but by either the arclength or by the generic parameters of >the Bezier curves it consists of. > >What happened, is that the "arclength" 3.1415 you inserted above, is >bigger than the total arclength of 1.25 of the circle. Therefore, you >get a point that is extrapolated from the very last path element the >circle consists of (This is probably a short closing line) > >This is what you wanted: >x, y = circle.at(0.) >x1, y1 = circle.at(0.5*circle.arclen()) >because the standard parameterisation is in arclength. > > Thank you. Ok, now a few things are falling into place, in particular the discussion of parameters in http://pyx.sourceforge.net/manual/node7.html I understand things a little better now (still more to grok). Does every path have an arclength? Even a compound path? I suppose so, since the circle is a compound path. I think that my confusion was caused in part by the fact that the example at the end of http://pyx.sourceforge.net/manual/node7.html uses a unit circle, so the arclength equals the angle. > > >>c.stroke(path.path(path.moveto(0,0), path.lineto(x, y))) >>c.stroke(path.path(path.moveto(0,0), path.lineto(x1, y1))) >>c.stroke(circle) >> >>c.writeEPSfile("test") >> >> >> > >Best, > Michael. > > > 