tex >> Why it is not filling? (Metapost)

by pth » Sun, 02 Nov 2003 22:18:50 GMT

From "Matej Cepl" < XXXX@XXXXX.COM >:
XXXX@XXXXX.COM ...

> Hi,
>
> sorry for slightly off-topic post, but I hope that MetaPost
> questions are at least slightly appropriate in this group as
> well. I have the following MP document (it is exported from
> drawing program, so it coordinates are not very nice). For some
> mysterious reason, path p3 is not filled (no errors or warnings
> are shown). Can anybody find a reason why (with previous version
> of the very same file -- with different ellipsoids -- it worked)?
>
> It is probably something trivial, but I really don't see anything
> wrong with this source.
>
> Thanks in advance for any hint,
>
> Matej Cepl
>
> % Converted from PostScript(TM) to MetaPost by pstoedit
> % MetaPost backend contributed by Scott Pakin < XXXX@XXXXX.COM >
> % pstoedit is Copyright (C) 1993 - 2001 Wolfgang Glunz < XXXX@XXXXX.COM >
>
> % Generate structured PostScript
> prologues := 1;
>
> % Display a given string with its *baseline* at a given location
> % and with a given rotation angle
> vardef showtext(expr origin)(expr angle)(expr string) =
> draw string infont defaultfont scaled defaultscale
> rotated angle shifted origin;
> enddef;
>
> beginfig(1);
> path p[];
> pickup pencircle scaled 1bp;
> defaultfont := "sldr8t";
> defaultscale := 10/fontsize defaultfont;
> linecap := butt;
> linejoin := mitered;
> draw (280.11,637.4)..controls (280.11,602.942) and
> (241.587,575.008)..(194.066,575.008)..controls (146.545,575.008) and
> (108.022,602.942)..(108.022,637.4)..controls (108.022,671.858) and
> (146.545,699.792)..(194.066,699.792)..controls (241.587,699.792) and
> (280.11,671.858)..(280.11,637.4) dashed evenly;
> p1 := (227.886,626.456)..controls (227.886,606.214) and
> (209.216,589.804)..(186.186,589.804)..controls (163.156,589.804) and
> (144.485,606.214)..(144.485,626.456)..controls (144.485,646.698) and
> (163.156,663.108)..(186.186,663.108)..controls (209.216,663.108) and
> (227.886,646.698)..(227.886,626.456);
> draw p1;
> showtext ((161.69,632.054), 0, "Rational");
> showtext ((160.194,620.084), 0, "behavior");
> showtext ((207.467,677.244), 0, "Arational");
> showtext ((209.075,666.011), 0, "behavior");
> p2 := (270.497,644.146)..controls (275.209,635.693) and (266.232,621.706)
> ..(250.446,612.906)
> ..controls (234.66,604.107) and (218.042,603.826)..(213.33,612.279)
> ..controls (208.618,620.731) and (217.596,634.718)..(233.382,643.518)
> ..controls (249.168,652.318) and (265.785,652.599)..(270.497,644.146);
> p3 := buildcycle(p1,p2);
> pickup pencircle scaled 1.5bp;
> % WHAT'S UP???
> fill p3 withcolor .5white;
> draw p2;
> showtext ((232.907,621.817), 29.1374, "Trust");
> endfig;
> end

p1:=subpath(-length p1 div 2,length p1 div 2) of (p1..cycle);
p3:= buildcycle(p1,p2);

Your path p1 is not a cycle; p1 starts and ends with the same point, a point of
the expected buildcycle p3.

~pth







Similar Threads

1. OT: Why it is not filling? (Metapost)

Hi,

sorry for slightly off-topic post, but I hope that MetaPost
questions are at least slightly appropriate in this group as
well. I have the following MP document (it is exported from
drawing program, so it coordinates are not very nice). For some
mysterious reason, path p3 is not filled (no errors or warnings
are shown). Can anybody find a reason why (with previous version
of the very same file -- with different ellipsoids -- it worked)?

It is probably something trivial, but I really don't see anything
wrong with this source.

	Thanks in advance for any hint,

		Matej Cepl

% Converted from PostScript(TM) to MetaPost by pstoedit
% MetaPost backend contributed by Scott Pakin < XXXX@XXXXX.COM >
% pstoedit is Copyright (C) 1993 - 2001 Wolfgang Glunz < XXXX@XXXXX.COM >

% Generate structured PostScript
prologues := 1;

% Display a given string with its *baseline* at a given location
% and with a given rotation angle
vardef showtext(expr origin)(expr angle)(expr string) =
  draw string infont defaultfont scaled defaultscale
    rotated angle shifted origin;
enddef;

beginfig(1);
path p[];
pickup pencircle scaled 1bp;
defaultfont := "sldr8t";
defaultscale := 10/fontsize defaultfont;
linecap := butt;
linejoin := mitered;
draw (280.11,637.4)..controls (280.11,602.942) and
     (241.587,575.008)..(194.066,575.008)..controls (146.545,575.008) and
     (108.022,602.942)..(108.022,637.4)..controls (108.022,671.858) and
     (146.545,699.792)..(194.066,699.792)..controls (241.587,699.792) and
     (280.11,671.858)..(280.11,637.4) dashed evenly;
p1 := (227.886,626.456)..controls (227.886,606.214) and
      (209.216,589.804)..(186.186,589.804)..controls (163.156,589.804) and
      (144.485,606.214)..(144.485,626.456)..controls (144.485,646.698) and
      (163.156,663.108)..(186.186,663.108)..controls (209.216,663.108) and
      (227.886,646.698)..(227.886,626.456);
draw p1;
showtext ((161.69,632.054), 0, "Rational");
showtext ((160.194,620.084), 0, "behavior");
showtext ((207.467,677.244), 0, "Arational");
showtext ((209.075,666.011), 0, "behavior");
p2 := (270.497,644.146)..controls (275.209,635.693) and (266.232,621.706)
   ..(250.446,612.906)
	..controls (234.66,604.107) and (218.042,603.826)..(213.33,612.279)
	..controls (208.618,620.731) and (217.596,634.718)..(233.382,643.518)
	..controls (249.168,652.318) and (265.785,652.599)..(270.497,644.146);
p3 := buildcycle(p1,p2);
pickup pencircle scaled 1.5bp;
% WHAT'S UP???
fill p3 withcolor .5white;
draw p2;
showtext ((232.907,621.817), 29.1374, "Trust");
endfig;
end

2. Why am I not getting a value?

3. Why can not display lable in the figure drawn by metapost in texlive2007

Hi,all,
I am learning MEATPOST, and just type the following code in a file named 
fig.mp

%%% fig.mp file%%%%%%%%%%%%
beginfig(1);
   a=.7in;b=.5in;
   z0=(0,0);
   z1=-z3=(a,0);
   z2=-z4=(0,b);
   draw z1..z2..z3..z4..cycle;
   draw z1--z0--z2;
   label.top("a",.5[z0,z1]);
   label.lft("b",.5[z0,z2]);
   dotlabel.bot("(0,0)",z0);
endfig;
end

%%%%%%%%%%% end file %%%%%%%%%%

This is an example of "A user's manual for MetaPost"(John D.Hobby) in chaper 
7 page 19.

But when I run by emacs23
mpost fig.mp

It seems ok.
Yet there is nothing in the file of fig.1.I mean it is all blank.
I don't know the reason.

Thank you for your help.





4. tabular* environment: why am I getting overfull errors?

5. fill patterns in xfig and metapost

Hi,

When I export some drawing to metapost in xfig, the fill patterns in the 
drawing dissapears.  But I can export to eps or pdf.  However, it seems 
to me that the fill patterns are some sorts of fonts, which are shown as 
Type 3 in the resulted pdf file.

What I want is: 1) ideally I can export to metapost, with the fill 
patterns; or 2) export to eps or pdf with Type 1 fonts.

I tried to search for answers but couldn't find any.

Can someone explain?

Thanks,

Xiaotian

6. Gradient Fill in MetaPost

7. why doesn't label in metapost center

Gjerrit Meinsma wrote:
> 
> Hi,
> 
> The mpost example below is supposed to center "W1" but doesn't
> 
> If I remove "prologues:=1" then it *does* center but then I cannot use 
> psfrag in latex to change W1 into something else.
> 
> Weird?
> 
> Regards,
> GM
> 
> 
> 
> prologues:=1;
> 
> \beginfig(6);
>   path p;
>   p := unitsquare scaled .7cm;
>   draw p ;
>   label("W1",center(p));
>   dotlabel("",center(p));
> \endfig;
> 
> bye
> 
It looks okay to me.  I processed the output file using LaTeX, ran the dvi file through dvips, and examined the resultant eps file using ghostview.  The dot is centered in the square and the W1 is centered in the box.

Charles B. Cameron

8. Why I get this error? (Metapost)