ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: Bug in latest beta, shifted metapost (possibly with drawarrow)
Date: Fri, 4 Nov 2016 11:00:35 +0100	[thread overview]
Message-ID: <8ca5f82e-3caf-a965-b495-e7918773ae82@wxs.nl> (raw)
In-Reply-To: <CAHy-LL_u6M0oikKWR4fxZfMLA6R3c0vY3RuXpHjGTpVUsSXVDQ@mail.gmail.com>

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
___________________________________________________________________________________

      reply	other threads:[~2016-11-04 10:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 16:09 Mikael P. Sundqvist
2016-11-04 10:00 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ca5f82e-3caf-a965-b495-e7918773ae82@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).