Re: [MetaPost] How to fill a closed path with a hatching?

Hartmut Henkel <[email protected]> Wed, 15 Jan 2003 20:41:04 +0100 (CET)
Newsgroups gmane.comp.tex.metafont
Message-ID <[email protected]>
...don't know what the proffessionals suggest, here is a quick cludge
just from a MetaPost fan.

% A4 :-)
paperheight =3D sqrt(sqrt(2))/4*1000mm;
paperwidth =3D paperheight/sqrt(2);

beginfig(1)
path p,q;
picture v;

% p =3D whatever your surrounding path is, e. g.:
p =3D fullcircle scaled 30mm;
q =3D bbox p;

hashwidth =3D 1mm;
hashes =3D xpart(lrcorner q - llcorner q) / hashwidth;

v =3D image(
  for i=3D0 upto hashes:
   draw llcorner q -- ulcorner q;
   currentpicture :=3D currentpicture shifted (hashwidth,0);
  endfor;
);

clip v to p;
draw v;
draw p;

currentpicture :=3D currentpicture
  shifted -0.5[lrcorner currentpicture, urcorner currentpicture]
  shifted 0.5(paperwidth,paperheight);
endfig;
end

Greetings Hartmut


On Wed, 15 Jan 2003, Martin Buchmann wrote:

> Hello,
>
> i hope this is the right place to ask but according to what i have read
> MetaPost question are "allowed" here too :-)
>
> I have a closed path between two paths which was build with the
> 'buildcycle' command and which i can fill with color using 'fill' etc...
> But now i want to use a easy hatching to fill this path, just vertical
> lines would be perfect at the moment. I found the 'mpattern' package bu=
t
> it looks a bit overscaled for my purpose and i was asking myself if
> there is a easier way to do it.
>
> What do the professionals suggest?
>
> Regards from Germany,
> Martin
>
> --
> Diese finden jenes, jene dieses sch=F6n. Aber sie m=FCssen es finden.
> Suchen will es keiner.
> 				-- Karl Kraus