Bug in latest beta, shifted metapost (possibly with drawarrow)
Dear list, the example below has shifted axes. I updated to the latest standalone earlier today. The problem was not present some weeks ago. In particular look at the red line that should start from the origin... \starttext \startMPpage ut:=1.0cm; ux:=0.6cm; vardef diffp(expr riktn) = ((-1,0)--(1,0)) rotatedaround (origin,angle(ut,riktn*ux)) enddef; path taxel,xaxel; taxel:=((-1.4,0)--(5.4,0)); xaxel:=((0,-1.4)--(0,4.6)); drawarrow taxel xyscaled(ut,ux); drawarrow xaxel xyscaled(ut,ux); label.bot("$t$", (point length(taxel) of taxel) xyscaled(ut,ux)); label.lft("$P$", (point length(xaxel) of xaxel) xyscaled(ut,ux)); draw image( vardef fun(expr t, x) = x*(3-x) enddef; for i=-1 step 0.5 until 5 : for j=-1 step 0.5 until 4 : ii:=i; jj:=j; draw diffp(fun(ii,jj)) scaled 2bp shifted (ii*ut,jj*ux); endfor; endfor; draw function (2, "x", "3/(1+2*exp(-3*x))" ,-1, 5, 1/5) xyscaled (ut,ux); draw (0,0)--(3,3) xyscaled(ut,ux) withcolor darkred; ); \stopMPpage \stoptext /Mikael
On 11/3/2016 5:09 PM, Mikael P. Sundqvist wrote:
Dear list,
the example below has shifted axes. I updated to the latest standalone earlier today. The problem was not present some weeks ago.
In particular look at the red line that should start from the origin...
\starttext \startMPpage ut:=1.0cm; ux:=0.6cm;
vardef diffp(expr riktn) = ((-1,0)--(1,0)) rotatedaround (origin,angle(ut,riktn*ux)) enddef;
path taxel,xaxel; taxel:=((-1.4,0)--(5.4,0)); xaxel:=((0,-1.4)--(0,4.6)); drawarrow taxel xyscaled(ut,ux); drawarrow xaxel xyscaled(ut,ux);
label.bot("$t$", (point length(taxel) of taxel) xyscaled(ut,ux)); label.lft("$P$", (point length(xaxel) of xaxel) xyscaled(ut,ux));
draw image( vardef fun(expr t, x) = x*(3-x) enddef; for i=-1 step 0.5 until 5 : for j=-1 step 0.5 until 4 : ii:=i; jj:=j; draw diffp(fun(ii,jj)) scaled 2bp shifted (ii*ut,jj*ux); endfor; endfor;
draw function (2, "x", "3/(1+2*exp(-3*x))" ,-1, 5, 1/5) xyscaled (ut,ux);
draw (0,0)--(3,3) xyscaled(ut,ux) withcolor darkred;
); \stopMPpage \stoptext
I'll fix it. Alan: we really need this one then: vardef image@#(text t) = save currentpicture ; picture currentpicture ; currentpicture := nullpicture ; t ; currentpicture if str @# <> "" : shifted ( mfun_labxf@# * lrcorner currentpicture + mfun_labyf@# * ulcorner currentpicture + (1-mfun_labxf@#-mfun_labyf@#) * llcorner currentpicture ) fi enddef ; -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Mikael P. Sundqvist