[metapost] Intersection of sets

Dan&Jan Luecking luecking at uark.edu
Sun Nov 1 22:18:29 CET 2009


At 12:25 PM 10/31/2009, you wrote:
>I don't know the exact logic behind, but it works now.

When MetaPost is looking for intersections, it doesn't take any
note of the fact that these paths are cycles, but it does take
note of the first point, the last point, and the direction of
a path.

Here are two pictures. The first is a depiction of what you asked
MP to build a cycle from. The second is Hartmut's (with the first
circle rotated 180 degrees). I have split the starting points from
the endings, and added an arrowhead on each path to emphasize the
above considerations.

You will note there is no cycle in the first picture, but there is one
in the second. Perhaps this can help you see the logic.

path p[];
u:=.5cm;
p2 := fullcircle scaled 6u shifted (3u,0);

beginfig(1)
pickup pencircle scaled .5bp;
p1:= fullcircle scaled 4u shifted (.2u,0);
drawarrow subpath (0.5,4) of p1;
draw subpath (4,7.5) of p1;
drawarrow subpath (0.5,4) of p2;
draw subpath (4,7.5) of p2;
endfig;

beginfig(2)
pickup pencircle scaled .5bp;
p1 := fullcircle rotated 180 scaled 4u shifted (.2u,0);
drawarrow subpath (0.5,4) of p1;
draw subpath (4,7.5) of p1;
drawarrow subpath (0.5,4) of p2;
draw subpath (4,7.5) of p2;
endfig;
end

Regards,
Dan

Dan Luecking
Fayetteville, Arkansas  



More information about the metapost mailing list