<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>I don't know the exact logic behind, but it works now.</DIV>
<DIV> </DIV>
<DIV>Thanks a lot. </DIV>
<DIV>Steve</DIV>
<DIV> </DIV>
<DIV><BR><BR>--- On <B>Sat, 10/31/09, Hartmut Henkel <I><hartmut_henkel@gmx.de></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Hartmut Henkel <hartmut_henkel@gmx.de><BR>Subject: Re: [metapost] Intersection of sets<BR>To: "Steve MC Han" <hmc0907@yahoo.com><BR>Cc: "Taco Hoekwater" <taco@elvenkind.com>, metapost@tug.org<BR>Date: Saturday, October 31, 2009, 9:21 AM<BR><BR>
<DIV class=plainMail>On Sat, 31 Oct 2009, Steve MC Han wrote:<BR><BR>> I was wondering if you could answer this question.<BR>> <BR>> To draw intersection of two sets, I tried this, but it didn't work.<BR>><BR>> beginfig(1)<BR>> u:=.5cm;<BR>> p1:= fullcircle scaled 4u shifted (.2u,0);<BR>> p2:= fullcircle scaled 6u shifted (3u,0);<BR>> fill buildcycle(p1,p2) withcolor (0,1,1);<BR>> draw p1;<BR>> draw p2;<BR>> label(btex $A$ etex, (-u,0));<BR>> label(btex $B$ etex, (3u,0));<BR>> endfig;<BR>> <BR>> Could you experts tell me what's wrong?<BR><BR>1st you need to declare the paths: path p[]; (maybe you have done this<BR>already before beginfig(1)); and the left fullcircle needs to be<BR>rotated, to "help buildcycle()" (i guess): a fullcircle is made from 4<BR>quarters, numbered 1...4 counterclockwise, so 2 quarters 1,4 are used<BR>from the left one, they intersect with quarters 2,3 from the right
one.<BR>Somehow (?) the number jump 4-->1 isn't liked by buildcycle(). If you<BR>rotate the left circle by 180 deg., quarters 2,3 are used also from the<BR>left one. Or e. g. by -90 it works as well, then quarters 1,2 used from<BR>the left circle.<BR><BR>path p[];<BR>beginfig(1)<BR>u:=.5cm;<BR>p1:= fullcircle rotated 180 scaled 4u shifted (.2u,0);<BR>p2:= fullcircle scaled 6u shifted (3u,0);<BR>fill buildcycle(p1,p2) withcolor (0,1,1);<BR>draw p1;<BR>draw p2;<BR>label(btex $A$ etex, (-u,0));<BR>label(btex $B$ etex, (3u,0));<BR>endfig;<BR><BR>end<BR><BR>Regards, Hartmut</DIV></BLOCKQUOTE></td></tr></table><br>