## [Pyx-user] Circle intersection

 [Pyx-user] Circle intersection From: - 2003-11-24 14:19:06 ```Hi pyx users I am new to pyx and postscript too. I need some help for a simple (I think) figure. I have two intersecting circles. I want to plot the union of this two circles. I try to use glue witwout resuslts ! Thank you for your help. Pierre JOYOT ESTIA LIPSI Technopole Izarbel 64210 BIDART T=E9l: 0559438445 Fax: 0559438401 = ```

 [Pyx-user] Circle intersection From: - 2003-11-24 14:19:06 ```Hi pyx users I am new to pyx and postscript too. I need some help for a simple (I think) figure. I have two intersecting circles. I want to plot the union of this two circles. I try to use glue witwout resuslts ! Thank you for your help. Pierre JOYOT ESTIA LIPSI Technopole Izarbel 64210 BIDART T=E9l: 0559438445 Fax: 0559438401 = ```
 Re: [Pyx-user] Circle intersection From: Andre Wobst - 2003-11-24 16:02:14 ```Hi Pierre, On 24.11.03, p.joyot@... wrote: > I am new to pyx and postscript too. > I need some help for a simple (I think) figure. > I have two intersecting circles. I want to plot the union of this two > circles. > I try to use glue witwout resuslts ! Check out the following example: from pyx import * from pyx.path import * circ1 = normpath(circle(0, 0, 1)) # you don't really need normpath, circ2 = normpath(circle(1, 1, 1)) # but its better to have it once # for those operations (circ1a, circ1b), (circ2a, circ2b) = circ1.intersect(circ2) intersection = (circ1.split(circ1b, circ1a)[1] << circ2.split(circ2a, circ2b)[1] << closepath()) union = (circ1.split(circ1b, circ1a)[0] << circ2.split(circ2a, circ2b)[0] << closepath()) c = canvas.canvas() c.fill(union, color.rgb.blue) c.fill(intersection, color.rgb.red) c.stroke(circ1, color.rgb.green) c.stroke(circ2) c.writetofile("circle") When I wrote this first, I steped into some strange behaviour of the resulting path. The point is, that you have to be carefull about the order of the split parameters (circ1a, circ1b, etc.). Their order is important. While this is not surprising, the problem might be, that the order of the return values from the intersect method is not clear. But they correspond to each other (circ1a is related to circ2a etc.) André -- by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ ```