[NTG-context] metapost fill between outlines

Hongwen Qiu qiuhongwen at gmail.com
Mon Feb 21 06:20:19 CET 2011


On 02/21/2011 01:12 PM, Reviczky, Adam wrote:
> \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.
\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;

drawarrow p1 withcolor green ;
drawarrow p2 withcolor blue ;
p3 := p1 -- p2 -- cycle;
fill p3 withcolor black;
\stopMPcode
}
\stoptext

Maybe you can know why now, from the above code. The direction of the 
path is important.


More information about the ntg-context mailing list