[metapost] buildcycle

Karel horakk at math.cas.cz
Mon Apr 19 03:24:25 CEST 2010


js stock napsal(a):
> Dear MetaPost users,
> 
>   I'm having troubles with the buildcycle macro. I tried to look around, 
> but found nothing helpful. It's just a simple source where I'd like the 
> intersection of the two cycles to be filled. It seems nothing is filled, 
> but actually (you can see it if you comment the "draw p; draw q;" line), 
> a very tiny portion of the figure seems to be returned by "buildcycle".
> Any help would be much appreciated!
> 
If you look into mpman.pdf you will find that it 
is not the easy case having two intersection 
points with "bad order". Moving the time of your 
paths will make it better:

fill buildcycle(subpath(2,6) of p,q) withcolor red;
fill buildcycle(p,subpath(2,6) of q) withcolor green;

Karel Horak

> GalTrack
> 
> ##
> beginfig(8);
> numeric a,b,c,d;
> a=.5in; b=.7in; c=.3in; d=.5in;
> z1=-z3=(a,0); z2=-z4=(0,b);
> path p,q;
> p=z1..z2..z3..z4..cycle;
> q=p shifted (-1cm,0);
> draw p;
> draw q;
> fill buildcycle(p,q) withcolor black;
> endfig;
> end
> 
> 
> ------------------------------------------------------------------------
> 
> --
> http://tug.org/metapost/



More information about the metapost mailing list