Re: [NTG-context] Bug in latest beta, shifted metapost (possibly with drawarrow)

2016-11-04 Thread Hans Hagen

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
-
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Bug in latest beta, shifted metapost (possibly with drawarrow)

2016-11-03 Thread Mikael P. Sundqvist
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


ctx-listexample17.pdf
Description: Adobe PDF document
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___