ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: metapost fill between outlines
@ 2011-02-21  5:12 Reviczky, Adam
  2011-02-21  5:20 ` Hongwen Qiu
  0 siblings, 1 reply; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-21  5:12 UTC (permalink / raw)
  To: ntg-context

> \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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: metapost fill between outlines
@ 2011-02-21  9:09 Reviczky, Adam
  2011-02-21  9:27 ` Hongwen Qiu
  2011-02-21  9:42 ` Mojca Miklavec
  0 siblings, 2 replies; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-21  9:09 UTC (permalink / raw)
  To: ntg-context

The only letter ("g") I have left in the logo has two spaces that I want to cut out.
I can't make a single path out of it so that it doesn't go through the entire letter, so what to do in this case?

Here's the example:
%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path gb[],gf[],gc[];

gb1 := (100.023003,46.691399)..controls (100.023003,47.015598) and (100.348000,47.203098)..(100.969002,47.203098)
	..controls (101.859001,47.203098) and (101.859001,46.855499)..(102.371002,46.855499)
	..controls (102.695000,46.855499) and (102.991997,47.015598)..(102.991997,47.582001)
	..controls (102.991997,48.066399) and (102.530998,48.230499)..(102.101997,48.230499)
	..controls (101.616997,48.230499) and (100.996002,48.093800)..(100.348000,47.664101)
	..controls (100.188004,47.527302) and (99.781197,47.339802)..(99.539101,47.500000)
	..controls (99.027298,47.851601) and (98.570297,48.093800)..(97.355499,48.093800)
	..controls (96.144501,48.093800) and (94.363297,47.367199)..(93.230499,45.828098)
	..controls (92.421898,44.695301) and (92.261703,43.886700)..(92.261703,43.078098)
	..controls (92.261703,42.269501) and (92.585899,41.675800)..(92.828102,41.355499)
	..controls (92.878899,41.273399) and (92.906197,41.218800)..(92.906197,41.136700)
	..controls (92.906197,40.949200) and (92.664101,40.812500)..(92.261703,40.707001)
	..controls (91.531197,40.464802) and (90.320297,39.761700)..(90.320297,38.523399)
	..controls (90.320297,37.714802) and (90.964798,36.933601)..(91.695297,36.445301)
	..controls (91.695297,36.445301) and (90.210899,36.042999)..(89.023399,35.394501)
	..controls (88.109398,34.882801) and (87.082001,34.101601)..(87.082001,32.968800)
	..controls (87.082001,31.675800) and (88.191399,29.570299)..(92.746101,29.570299)
	..controls (95.414101,29.570299) and (97.085899,30.539101)..(97.734398,31.269501)
	..controls (98.218803,31.835899) and (98.296898,32.484402)..(98.296898,32.886700)
	..controls (98.296898,34.343800) and (96.683601,35.718800)..(94.902298,36.687500)
	..controls (93.769501,37.335899) and (92.097702,38.117199)..(92.097702,39.277302)
	..controls (92.097702,39.574200) and (92.179703,39.898399)..(92.503899,40.085899)
	..controls (92.718803,40.250000) and (93.070297,40.328098)..(93.445297,40.328098)
	..controls (93.957001,40.328098) and (94.605499,40.167999)..(95.066399,40.167999)
	..controls (96.519501,40.167999) and (98.488297,40.652302)..(99.703102,43.242199)
	..controls (100.023003,43.968800) and (100.160004,44.695301)..(100.160004,45.316399)
	..controls (100.160004,46.125000) and (100.023003,46.316399)..(100.023003,46.691399)
	--cycle;
drawdot (100.023003,46.691399) withcolor blue withpen pencircle scaled 2pt;

gf2 := (92.960899,30.351601)..controls (89.968803,30.351601) and (89.078102,32.078098)..(89.078102,32.941399)
	..controls (89.078102,33.750000) and (89.402298,34.261700)..(90.210899,34.828098)
	..controls (90.777298,35.234402) and (91.613297,35.636700)..(92.261703,35.878899)
	..controls (92.988297,35.558601) and (94.093803,34.910198)..(94.445297,34.585899)
	..controls (96.062500,33.453098) and (96.386703,32.808601)..(96.386703,32.242199)
	..controls (96.386703,30.703100) and (94.093803,30.351601)..(92.960899,30.351601)
	--cycle;
drawdot (92.960899,30.351601) withcolor green withpen pencircle scaled 2pt;

gf1 := (98.867203,46.367199)..controls (98.867203,45.585899) and (98.570297,44.535198)..(97.894501,43.402302)
	..controls (96.628899,41.355499) and (95.628899,40.949200)..(94.769501,40.949200)
	..controls (94.039101,40.949200) and (93.714798,41.542999)..(93.714798,42.406200)
	..controls (93.714798,43.160198) and (94.039101,44.132801)..(94.605499,45.019501)
	..controls (95.468803,46.394501) and (96.683601,47.527302)..(97.761703,47.527302)
	..controls (98.488297,47.527302) and (98.867203,47.175800)..(98.867203,46.367199)
	--cycle;
drawdot (98.867203,46.367199) withcolor yellow withpen pencircle scaled 2pt;

gc1 := gb1 -- gf1 -- cycle;
gc2 := gc1 -- gf2 -- cycle;
fill gc2;
\stopMPcode
}
\stoptext
%%%

How do I get rid of the crossing line?

Adam
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: metapost fill between outlines
@ 2011-02-21  6:41 Reviczky, Adam
  2011-02-21  6:55 ` Hongwen Qiu
  0 siblings, 1 reply; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-21  6:41 UTC (permalink / raw)
  To: ntg-context

So with this method, I can cut out some fillings of letters in a logo,
but for this example it draws a small line through the letter:

%%%
\starttext
\framed[background=color,backgroundcolor=red,height=fit,width=fit]{
\startMPcode
path db[],df[],dc[];

drawoptions (withcolor (0.000000,0.329412,0.560784));
db1 := (86.812500,0.519531)--(92.457001,0.519531)--(92.457001,32.386700)
	--(86.812500,32.386700)--(86.812500,19.679701)--(86.722702,19.679701)
	..controls (85.390602,21.589800) and (82.816399,22.718800)..(79.929703,22.718800)
	..controls (73.976601,22.718800) and (69.800797,17.253901)..(69.800797,11.617200)
	..controls (69.800797,4.683590) and (73.664101,0.000000)..(79.484398,0.000000)
	..controls (82.949203,0.000000) and (85.257797,1.820310)..(86.722702,3.640620)
	--(86.812500,3.640620)--cycle;

df1 := (81.437500,19.246099)..controls (84.992203,19.246099) and (86.812500,15.734400)..(86.812500,11.964800)
	..controls (86.812500,7.625000) and (85.128899,3.464840)..(81.171898,3.464840)
	..controls (77.753899,3.464840) and (76.062500,7.542970)..(76.062500,11.746100)
	..controls (76.062500,15.953100) and (77.621101,19.246099)..(81.437500,19.246099)
	--cycle;

draw db1; draw df1;
dc1 := db1 -- df1 -- cycle;
fill dc1;
\stopMPcode
}
\stoptext
%%%

Can this be solved somehow?

Adam
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: metapost fill between outlines
@ 2011-02-21  5:29 Reviczky, Adam
  0 siblings, 0 replies; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-21  5:29 UTC (permalink / raw)
  To: ntg-context

>> Maybe you can know why now, from the above code. The direction of the 
>> path is important.
I get it now, thanks for your help!
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: metapost fill between outlines
@ 2011-02-20 19:52 Reviczky, Adam
  2011-02-21  3:27 ` Hongwen Qiu
  0 siblings, 1 reply; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-20 19:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> You can fill out the bigger one, than clips the smaller one.
Can you give me an example with the clip? I can't get it work in a way I want to have it.
I've found another thread here: http://www.tug.org/pipermail/metapost/2006-September/000650.html
But I fail to see the conclusion there too.

> And alternately, you can construct the path of the difference out of the 
> two circles, and fill the constructed path.
As for the path of the difference, how do you mean that? Example?

Adam
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread
* metapost fill between outlines
@ 2011-02-20  8:25 Reviczky, Adam
  2011-02-20  8:41 ` Hongwen Qiu
  0 siblings, 1 reply; 13+ messages in thread
From: Reviczky, Adam @ 2011-02-20  8:25 UTC (permalink / raw)
  To: ntg-context

Hi

Is it possible to fill out a space between two outlines?
As for an example, I'd like to draw two circles (same center, one bigger than the other) and fill out the difference.
Something like the letter "O".

Here's a concrete example:
%%%
draw (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;

draw (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;
%%%

I want to fill out the space between these two draw lines.
Is this actually possible? The only reference to this I found was on wikipedia: "Most notably, paths can have only one segment (so that regions are simply connected), (...)" (http://en.wikipedia.org/wiki/MetaPost).
I thought I ask here before I put this aside.

As a workaround I fill out the bigger one with color black and the smaller one with color white, but I need to put this on different background colors, so the use of this is very limited.
How does it work with fonts (Metafont)? Who's filling that out, because thats also just based on outlines, right?

Thanks
Adam
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-02-21 10:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21  5:12 metapost fill between outlines Reviczky, Adam
2011-02-21  5:20 ` Hongwen Qiu
  -- strict thread matches above, loose matches on Subject: below --
2011-02-21  9:09 Reviczky, Adam
2011-02-21  9:27 ` Hongwen Qiu
2011-02-21  9:42 ` Mojca Miklavec
2011-02-21 10:04   ` Reviczky, Adam
2011-02-21  6:41 Reviczky, Adam
2011-02-21  6:55 ` Hongwen Qiu
2011-02-21  5:29 Reviczky, Adam
2011-02-20 19:52 Reviczky, Adam
2011-02-21  3:27 ` Hongwen Qiu
2011-02-20  8:25 Reviczky, Adam
2011-02-20  8:41 ` Hongwen Qiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).