|
From: Michael S. <mic...@ph...> - 2003-04-25 17:01:11
|
Dear André and Jörg,
first of all I really have to stress (once more) that with PyX you have
created a really _great_ program. Again and again it is astonishing,
how powerful it is and what difficult problems it can solve.
This is exactly what many many poor producers of scientific plots
dreamed of !!!
Nevertheless I have a little problem with the parameter calculations
that are done in path.at().
The documentation in the path.py module claims that I can use negative
values in at(). But when comparing at(0.5) and at(-0.5) on a single
path element, the outcome is not the same. The latter does not even
lie on the path.
This can be easily repaired in path.py by setting the negative value
to a positive ...)
But there is a bigger problem when several subpaths are used. Then the
path is reverted by path.reversed() when using negative values in
path.at().
In the example below I use two straight lines as subpaths. The
parameter range is then from 0 to 2. When asking for path.at(0.5) and
path.at(-0.5) I expect the points on different lines, but both lie on
the first (long) one.
So at(0.5) and at(-0.5) are the same, as well as
at(1.5) and at(-1.5).
Best greetings from Augsburg ;-)
Michael Schindler.
################ example code ##########
import pyx
from pyx import *
from pyx.path import *
c = canvas.canvas()
# one long and one short line, _not_ connected
p = path(moveto(0,0), lineto(10,10), moveto(10,0), lineto(15,5))
# learn what is done during reversion
for pel in p:
print pel
print
for pel in p.reversed():
print pel
c.stroke(p)
# the first circle is where it is expected
c.stroke(circle(p.at(0.5)[0], p.at(0.5)[1], 0.2), color.rgb.red)
# the second should be in the middle of the short line
# but see where it is!
c.stroke(circle(p.at(-0.5)[0], p.at(-0.5)[1], 0.2), color.rgb.blue)
# after setting t to -t in path.py
# this should be in the middle of the short line
# but is this what we expect for t=-1.5?
c.stroke(circle(p.at(-1.5)[0], p.at(-1.5)[1], 0.2), color.rgb.green)
c.writetofile("pyxbug", paperformat="a4", fittosize=1)
############## END ##########
--
"A mathematician is a device for turning coffee into theorems"
Paul Erdös.
|