[NTG-context] metapost fill between outlines

Reviczky, Adam adam.reviczky at kcl.ac.uk
Mon Feb 21 06:12:09 CET 2011


> \startMPpage
> path p ;
> p := fullcircle scaled 1cm ;
> path q ;
> q := fullcircle scaled .5cm ;
> path r ;
> r := p -- reverse q -- cycle ;
> drawarrow r withcolor green ;
> fill r withcolor red ;
> \stopMPpage
> 
> This works here.
Based on this I can now cut out the smaller one from a fullcircle, but it still fails with two paths having controls (or maybe because of something else).

Here are the examples:
%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := fullcircle scaled 2cm;

p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and (1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) and (1.695310,0.835938)..(2.722660,0.835938)..controls (5.230470,0.835938) and (8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) and (8.703120,12.293000)..(7.488280,12.293000)--cycle;

p3 := p1 -- reverse p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext
%%%
This works.

%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path p[];
p1 := (6.949220,13.046900)..controls (9.539060,13.046900) and (10.023400,10.781200)..(10.023400,8.679690)..controls (10.023400,5.335940) and (6.949220,0.000000)..(3.234380,0.000000)..controls (0.890625,0.000000) and (0.000000,1.886720)..(0.000000,3.828120)..controls (0.000000,8.492190) and (3.316410,13.046900)..(6.949220,13.046900) --cycle;

p2 := (7.488280,12.293000)..controls (4.933590,12.293000) and (1.265620,6.226560)..(1.265620,2.531250)..controls (1.265620,1.562500) and (1.695310,0.835938)..(2.722660,0.835938)..controls (5.230470,0.835938) and (8.972660,7.035160)..(8.972660,10.296900)..controls (8.972660,11.269500) and (8.703120,12.293000)..(7.488280,12.293000)--cycle;

p3 := p1 -- reverse p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext
%%%
This doesn't work.
(It fails already if "p1 := (0,0)..(0,20)..(20,20)..cycle;" or similar.)
Any hints?

Adam


More information about the ntg-context mailing list