[metapost] how to draw the water flow

Pétiard François petiard.francois at free.fr
Thu Jun 11 11:15:28 CEST 2009


Le 10/06/2009 20:25, hjw0848 a écrit :
> Hi,
> 
> I'm new to the Metapost.  I want to draw some figures whick looks
> like the water-flow (see the attachment).  Dose anyone show me how to
> draw them?  Thank you very much.
> 
> Cheers Hong
> 

picture p;
path ligne;
pair O;
numeric u;
u:=1mm;
O:=u*(30,30);
drawarrow (1.2*xpart(O),0)--(0.6*xpart(O),0);
drawarrow (0.6*xpart(O),0)--(0,0)--(0,0.6*ypart(O));
draw (0,0.6*ypart(O))--(0,1.2*ypart(O));
ligne:=reverse(quartercircle scaled(2*0.8*xpart(O)) rotated(-180)
shifted(O));
drawarrow ligne cutafter(point(1) of ligne);
drawarrow (ligne cutafter(point(1) of ligne)) reflectedabout((0,0),(0,1));
draw ligne cutbefore(point(1) of ligne);
draw (ligne cutbefore(point(1) of ligne)) reflectedabout((0,0),(0,1));
ligne:=reverse(quartercircle scaled(2*0.6*xpart(O)) rotated(-180)
shifted(O));
drawarrow ligne cutafter(point(1) of ligne);
drawarrow (ligne cutafter(point(1) of ligne)) reflectedabout((0,0),(0,1));
draw ligne cutbefore(point(1) of ligne);
draw (ligne cutbefore(point(1) of ligne)) reflectedabout((0,0),(0,1));
p:=currentpicture;
currentpicture:=nullpicture;

draw p rotated(45);
draw p rotated(225);

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-waterflow_001.pdf
Type: application/pdf
Size: 3232 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20090611/233e6cee/attachment.pdf>


More information about the metapost mailing list