j.romildo | 9 Oct 21:14 2006
Picon

fill bpath does not work

Hello.

I have a small metapost figure which is not built as I expect. The
metapost program is as follows:

   % test.mp

   prologues := 2;
   input boxes;

   beginfig(6)
     boxjoin(  a.e = b.w - (4mm,0) );
     boxit.a1("1");
     boxit.a2("2");
     boxit.a3("3");
     fill bpath a1 withcolor 0.8white;
     fill bpath a2 withcolor white;
     fill bpath a3 withcolor 0.8white;
     drawboxed(a1,a2,a3);
   endfig;

   end

And the output image can be seen at
http://www.decom.ufop.br/prof/romildo/misc/test.6, while the the figure
I was expecting should look like this
http://www.decom.ufop.br/prof/romildo/misc/test.new.6

Can anybody take a quick look at this and tell me why that happens?

(Continue reading)

Piotr Zielinski | 9 Oct 21:46 2006
Picon

Re: fill bpath does not work

On 09/10/06, j.romildo <at> gmail.com <j.romildo <at> gmail.com> wrote:
> I have a small metapost figure which is not built as I expect. The
> metapost program is as follows: [...]
>
> Can anybody take a quick look at this and tell me why that happens?

I can't reproduce this; when I put your file through metapost, I get
the picture you expect.  What version of metapost are you using?  I
have Version 0.641 (Web2C 7.5.4).

Piotr

--

-- 
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/
_______________________________________________
metapost mailing list
http://tug.org/mailman/listinfo/metapost

j.romildo | 9 Oct 22:12 2006
Picon

Re: fill bpath does not work

On Mon, Oct 09, 2006 at 09:46:31PM +0200, Piotr Zielinski wrote:

> On 09/10/06, j.romildo <at> gmail.com <j.romildo <at> gmail.com> wrote:
> >I have a small metapost figure which is not built as I expect. The
> >metapost program is as follows: [...]
> >
> >Can anybody take a quick look at this and tell me why that happens?
> 
> I can't reproduce this; when I put your file through metapost, I get
> the picture you expect.  What version of metapost are you using?  I
> have Version 0.641 (Web2C 7.5.4).

On Mon, Oct 09, 2006 at 09:58:33PM +0200, Wim W. Wilhelm wrote:
> Output looked fine.
> Tested on XP systeem, with metapost 0.901.

$ mpost 
This is MetaPost, Version 0.901 (Web2C 7.5.5)

I am running gentoo linux on amd64.

So something is messed here :( Maybe I should reinstall tetex, then.

Regards.

Romildo
_______________________________________________
metapost mailing list
http://tug.org/mailman/listinfo/metapost

(Continue reading)

Wim W. Wilhelm | 9 Oct 21:58 2006
Picon

Re: fill bpath does not work

Output looked fine.
Tested on XP systeem, with metapost 0.901.
Wim W. Wilhelm

----- Original Message ----- 
From: <j.romildo <at> gmail.com>
To: <metapost <at> tug.org>
Sent: Monday, October 09, 2006 9:14 PM
Subject: [metapost] fill bpath does not work

> Hello.
> 
> I have a small metapost figure which is not built as I expect. The
> metapost program is as follows:
> 
>   % test.mp
> 
>   prologues := 2;
>   input boxes;
> 
>   beginfig(6)
>     boxjoin(  a.e = b.w - (4mm,0) );
>     boxit.a1("1");
>     boxit.a2("2");
>     boxit.a3("3");
>     fill bpath a1 withcolor 0.8white;
>     fill bpath a2 withcolor white;
>     fill bpath a3 withcolor 0.8white;
>     drawboxed(a1,a2,a3);
>   endfig;
(Continue reading)

j.romildo | 9 Oct 22:45 2006
Picon

Re: fill bpath does not work

On Mon, Oct 09, 2006 at 04:14:03PM -0300, j.romildo <at> gmail.com wrote:

> I have a small metapost figure which is not built as I expect. The
> metapost program is as follows:

Well, the program I have posted is the one that produces the second
image (the expected one, without the "bug").

> 
>    % test.mp
> 
>    prologues := 2;
>    input boxes;
> 
>    beginfig(6)
>      boxjoin(  a.e = b.w - (4mm,0) );
>      boxit.a1("1");
>      boxit.a2("2");
>      boxit.a3("3");
>      fill bpath a1 withcolor 0.8white;
>      fill bpath a2 withcolor white;
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This line should be commented out.

>      fill bpath a3 withcolor 0.8white;
>      drawboxed(a1,a2,a3);
>    endfig;
> 
>    end
> 
(Continue reading)

Piotr Zielinski | 9 Oct 23:09 2006
Picon

Re: fill bpath does not work

On 09/10/06, j.romildo <at> gmail.com <j.romildo <at> gmail.com> wrote:
> >    % test.mp
> >
> >    prologues := 2;
> >    input boxes;
> >
> >    beginfig(6)
> >      boxjoin(  a.e = b.w - (4mm,0) );
> >      boxit.a1("1");
> >      boxit.a2("2");
> >      boxit.a3("3");
> >      fill bpath a1 withcolor 0.8white;
> >      fill bpath a2 withcolor white;
>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This line should be commented out.
>
> >      fill bpath a3 withcolor 0.8white;
> >      drawboxed(a1,a2,a3);
> >    endfig;
> >
> >    end
> >
> > And the output image can be seen at
> > http://www.decom.ufop.br/prof/romildo/misc/test.6, while the the figure
> > I was expecting should look like this
> > http://www.decom.ufop.br/prof/romildo/misc/test.new.6
> >
> > Can anybody take a quick look at this and tell me why that happens?

Add the line:
(Continue reading)

Clément Hurlin | 10 Oct 17:15 2006
Picon
Picon

precision of division

Dear users of metapost,

  I'm not an expert but I have used metapost for some drawings and, recently, 
I've faced a problem when I try to build cycles involving points on a circle. 
You can see it on the following pdf file:
http://www-sop.inria.fr/everest/Clement.Hurlin/figure.pdf

I've divided the quarter circle from p0 to p2 into six equal paths: q0 -- q1, 
q1 -- q2, ..., by doing:

  pair q[]; % calcul des points d'approximation
  for $:=0 upto i:
    q[$] = point $ * length pt[1]/i of pt[1];           (1)
  endfor
(where pt[1] is the quarter circle and i is the number of parts of the 
"camembert" (in this example 6). You can see the complete, small source at:
http://www-sop.inria.fr/everest/Clement.Hurlin/figure.mp )

Later I try to fill the different parts of the camembert by doing:
  % calcul des parts
  for $:=0 upto i - 1:
    show $;
    qt[$] := q[$] -- p[3] -- q[$+1]; 
    pt[3] := pt[1] cutbefore q[$] cutafter q[$+1]; 

    show point infinity of qt[$];
    show point infinity of (pt[3]);

    show point 0 of  qt[$];
    show point 0 of (pt[3]);
(Continue reading)

Dan Luecking | 10 Oct 22:03 2006
Picon

Re: precision of division

At 10:15 AM 10/10/2006, you wrote:
>Dear users of metapost,
>
>   I'm not an expert but I have used metapost for some drawings and, 
> recently,
>I've faced a problem when I try to build cycles involving points on a circle.
>You can see it on the following pdf file:
>http://www-sop.inria.fr/everest/Clement.Hurlin/figure.pdf
>
>I've divided the quarter circle from p0 to p2 into six equal paths: q0 -- q1,
>q1 -- q2, ..., by doing:
>
>   pair q[]; % calcul des points d'approximation
>   for $:=0 upto i:
>     q[$] = point $ * length pt[1]/i of pt[1];
>
>          (1)

These won't necessarily be "equal" parts. To get that you would use
"p0 rotated (90/6)". What you have is "equal time" subdivisions.
Anyway, MP's quartercircle (if that's how you got pt[1]) has two segments,
so length pt[1] is 2, and pt[1]/i = 1/3 which MP stores internally
as 21845/65536 (actually as the integer 21845). That happens to be
accurate to 1 part in 196608, i.e., plus or minus .000005.

In general, simple calculations are rounded to 16 binary places, and 
so are accurate to plus or minus 2^{-17}

>  I try to fill the different parts of the camembert by doing:
>   % calcul des parts
(Continue reading)

L. Nobre G. | 11 Oct 00:21 2006
Picon

Re: precision of division

On 10/10/06, Dan Luecking <luecking <at> uark.edu> wrote:
> MP may decide that paths do
> intersect which actually do not, and vice versa.

That's really annoying. Should be fixed.

> One should never actually rely on MP to detect that paths intersect
> except in one circumstance: if the paths intersect transversally
> (i.e., not tangentially) at a points on each that are strictly between
> nodes (i.e., at non-integer times). Even then the points of
> intersection that one obtains need not be strictly equal.

Ah-a! You have done some studies on this subject, right?
Would you be so kind as to provide a predictable implementation of a
intersectionpoint macro?
I don't know enough to do it myself...
--

-- 
L. Nobre G. - http://lnobreg.googlepages.com/
--
"For better or for worse, people outside the West are fleeing
self-sufficient and isolated societies in an effort to raise their
standards of living by becoming interdependent in much larger
markets." Hernando de Soto  in The Mystery of Capital
_______________________________________________
metapost mailing list
http://tug.org/mailman/listinfo/metapost

Clément Hurlin | 12 Oct 09:04 2006
Picon
Picon

Re: precision of division

> Does what make sense?
I was just wondering if my suppositions about the loss of precision was right.

> Here is what I would do. Assuming that you really want the points
>    q[$] := point $*length pt[1]/i of pt[1];
> I would save those times instead of the points:
>    t[$] := $*length pt[1]/i;
> then if I need to fill a wedge, I would write:
>    fill p3-- subpath(t[$],t[$+1]) of p --cycle;
This works, thanks.

Clément
_______________________________________________
metapost mailing list
http://tug.org/mailman/listinfo/metapost


Gmane