... something like the stuff below should apply to general path
elements, though I haven't thought too much^Wat all about arc elements:
One may need to check whether 2j*pi needs to be added/subtracted for an
arc element or not, depending on the angles, i.e. depending on which
side of the secant a point lies: the same as the arc or the other side.
Also, this does not catch points on the path (but would be easy for line
elements).
(Note that log(a/b) in general differs from log(a)-log(b), or else the
sum below would all add up to zero winding number.)
Now back to my complex analysis class :)
Michael
------------->8------------
from pyx import *
import cmath
pts = [ (-2,-1), (1,1), (0,-1), (-1,1), (2,-1), (2,1.5), (-2,1.5) ]
pthelts = [ path.moveto( *pts[0] ) ]
pthelts += [ path.lineto( *pt ) for pt in pts[1:] ]
pthelts += [ path.closepath() ]
c = canvas.canvas()
c.stroke(path.path(*pthelts))
chks = [ (-0.5,-0.5), (-1,0), (0,0), (1,0), (0.5,-0.5), (0.5,0.5),
(-0.5,0.5) ]
colors = { True: color.rgb.green, False: color.rgb.red }
for chk in chks:
cchk = complex(*chk)
w = 0
pt1 = pts[-1]
for pt in pts:
w += cmath.log( (complex(*pt)-cchk) / (complex(*pt1)-cchk) )
pt1 = pt
print chk, w/(2j*cmath.pi)
c.fill( path.circle(*chk, radius=0.05), [colors[abs(w)>1.0e-15]] )
c.writePDFfile()
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user