Hello Bruce, Hello Hans, Thank you very much for your help and input. I tested the proposed patch with the minimal example, and the glitch indeed disappeared. I have to admit, I wasn’t aware that metafun could run in different instances, let alone the existence of both a double instance and a scaled instance. While your patch is quite clear, the inner workings of metapost are a mystery to me. I greatly appreciate the quick fix and the explanation. Best regards, Bernd --- This version improves readability, fixes minor typos, and maintains a polite, professional tone. On Wed, Oct 16, 2024, 22:34 Hans Hagen via ntg-context wrote: > Hi Bruce, > > > If you change the following MWE line > > > > \connection [bt] {compiler} > > > > to > > > > \connection [br] {compiler} > > > > then the glitch goes away, so I suggest that means it is a bug in the > flow chart module. > > Actually not (but you're close) ... so for a moment put your calculator > (hardware) hat on (although they use decimal clipping and rounding i guess) > > You noticed that coming from one directions gives a different result > than coming from the other: > > metapost > message : 1.4999979972839355 1.8181943026455964 > metapost > message : 1.5 2.1818056973544033 > > Now, why does this fail? We use a double instance here and as we > calculate intersection points we are too precise compared to scaled > where we get twice 1.5, so the points collapse in scaled mode and not in > double. Maybe I need to make some helper for clipping a given precision. > > The mp graphic that does the framed loads a metafun double instance so a > later instance with the same name in the chart (lua) module takes that > one; when it is the first one it will take the scaled instance (mkiv is > scaled by default and mkxl defaults to double). > > We can run these charts in their own instance (i'll do that). > > Here is the patch for mp-char.mpiv that fixes the issue: > > def flow_collapse_points = % this can become a core macro > begingroup ; > % remove redundant points > save n ; numeric n ; > n := 1 ; > for i=2 upto flow_xypoint : > % if not (flow_xypoints[i] = flow_xypoints[n]) : > if abs(flow_xypoints[i] - flow_xypoints[n]) > eps : > n := n + 1 ; > flow_xypoints[n] := flow_xypoints[i] > fi ; > endfor ; > flow_xypoint := n ; > % make straight lines > % if flow_xypoints[2] = flow_xypoints[flow_xypoint-1] : > if abs(flow_xypoints[2] - flow_xypoints[flow_xypoint-1]) < eps : > flow_xypoints[3] := flow_xypoints[flow_xypoint] ; > flow_xypoint := 3 ; > fi ; > endgroup ; > enddef ; > > But best check this! So the bt / tb was a clue indeed. > > Hans > > ----------------------------------------------------------------- > 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 / > https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > > ___________________________________________________________________________________ >