Re: [NTG-context] Metapost - Seems like weird behavior. Is it a bug?
Taco, thanks for the suggestions. I will try using intersectiontimes. It would be great if, as you said, this is solved with Metapost 2.0. Any idea when that version is coming out? Thanks. On Wed, Nov 25, 2009 at 2:47 AM, Taco Hoekwater t...@elvenkind.com wrote: Taco Hoekwater wrote: The solution is to add an explicit fix to Lint[4] just after its current assignment: Lint[4]:=(xpart Lint[4], 0); Even better is to not use intersectionpoint at all: use intersectiontimes instead. With that, you can select a point that is guaranteed to be on one of the two paths. Best wishes, Taco ___ 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 ___ ___ 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 ___
Re: [NTG-context] Metapost - Seems like weird behavior. Is it a bug?
Curiouslearn wrote: Taco, thanks for the suggestions. I will try using intersectiontimes. It would be great if, as you said, this is solved with Metapost 2.0. Any idea when that version is coming out? Next summer ___ 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 ___
[NTG-context] Metapost - Seems like weird behavior. Is it a bug?
The code below shows a cyclic path that I am interested in creating (it is in red if you run the code). The example works fine as long as I have, u:=1cm, as in the code below. But if I replace it by , u:=0.6cm, there is no output. There is an error saying that paths 4 and 3 do not intersect. Is this a bug? Thanks for your help. \setuppapersize[letter][letter] \setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in] \setupcolors[state=start] \starttext \startuseMPgraphic{buildS22} numeric u; u := 1cm; w:= 2pt; path xaxis; path yaxis; xaxis := (0,0)--(12,0) scaled u; yaxis := (0,0)--(0,12) scaled u; path stLine; path Curve; stLine := function (1,x,10-x,0,10,1) scaled u; Curve := function(1,x,2+8/x,1,10,0.1) scaled u; drawarrow xaxis withpen pencircle scaled w; drawarrow yaxis withpen pencircle scaled w; draw stLine withpen pencircle scaled w withcolor 0.5red; draw Curve withpen pencircle scaled w withcolor 0.5green; pair Lint[]; Lint[1]:=yaxis intersectionpoint stLine; Lint[2]:=stLine intersectionpoint Curve; Lint[3]:=reverse stLine intersectionpoint Curve; Lint[4]:=stLine intersectionpoint xaxis; path cyclicPath; cyclicPath := buildcycle(Lint[1]--Lint[2],Curve,Lint[3]--Lint[4],reverse xaxis,yaxis); draw cyclicPath withpen pencircle scaled 5pt withcolor red; \stopuseMPgraphic \useMPgraphic{buildS22} \stoptext ___ 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 ___
Re: [NTG-context] Metapost - Seems like weird behavior. Is it a bug?
On Wed, Nov 25, 2009 at 5:45 AM, Curiouslearn curiousle...@gmail.com wrote: The code below shows a cyclic path that I am interested in creating (it is in red if you run the code). The example works fine as long as I have, u:=1cm, as in the code below. But if I replace it by , u:=0.6cm, there is no output. There is an error saying that paths 4 and 3 do not intersect. Is this a bug? Thanks for your help. \setuppapersize[letter][letter] \setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in] \setupcolors[state=start] \starttext \startuseMPgraphic{buildS22} numeric u; u := 1cm; w:= 2pt; path xaxis; path yaxis; xaxis := (0,0)--(12,0) scaled u; yaxis := (0,0)--(0,12) scaled u; path stLine; path Curve; stLine := function (1,x,10-x,0,10,1) scaled u; Curve := function(1,x,2+8/x,1,10,0.1) scaled u; drawarrow xaxis withpen pencircle scaled w; drawarrow yaxis withpen pencircle scaled w; draw stLine withpen pencircle scaled w withcolor 0.5red; draw Curve withpen pencircle scaled w withcolor 0.5green; pair Lint[]; Lint[1]:=yaxis intersectionpoint stLine; Lint[2]:=stLine intersectionpoint Curve; Lint[3]:=reverse stLine intersectionpoint Curve; Lint[4]:=stLine intersectionpoint xaxis; path cyclicPath; cyclicPath := buildcycle(Lint[1]--Lint[2],Curve,Lint[3]--Lint[4],reverse xaxis,yaxis); draw cyclicPath withpen pencircle scaled 5pt withcolor red; \stopuseMPgraphic \useMPgraphic{buildS22} \stoptext ___ 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 ___ hm.. can you try with tracingall; cyclicPath := buildcycle(Lint[1]--Lint[2],Curve,Lint[3]--Lint[4],reverse xaxis,yaxis); ? -- luigi ___ 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 ___
Re: [NTG-context] Metapost - Seems like weird behavior. Is it a bug?
luigi scarso wrote: On Wed, Nov 25, 2009 at 5:45 AM, Curiouslearn curiousle...@gmail.com wrote: The code below shows a cyclic path that I am interested in creating (it is in red if you run the code). The example works fine as long as I have, u:=1cm, as in the code below. But if I replace it by , u:=0.6cm, there is no output. There is an error saying that paths 4 and 3 do not intersect. Is this a bug? More a 'known limitation': intersection point calculations are not perfect because of the fixed precision calculus. Lint[4] is the culprit. With u=0.6cm it has these coordinates: (170.07976,0.00014). Notice how the y coordinate is not actually on the xaxis? That is because the actual intersection between stLine and xaxis does not fit nicely into a scaled pair, so metapost takes the 'closest approximation', which in this case is slightly off both lines. The solution is to add an explicit fix to Lint[4] just after its current assignment: Lint[4]:=(xpart Lint[4], 0); This is not pretty, and one of the problems we hope to solve with metapost 2.0. Best wishes, Taco ___ 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 ___
Re: [NTG-context] Metapost - Seems like weird behavior. Is it a bug?
Taco Hoekwater wrote: The solution is to add an explicit fix to Lint[4] just after its current assignment: Lint[4]:=(xpart Lint[4], 0); Even better is to not use intersectionpoint at all: use intersectiontimes instead. With that, you can select a point that is guaranteed to be on one of the two paths. Best wishes, Taco ___ 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 ___