From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: Artifact in flow cell connection
Date: Wed, 16 Oct 2024 22:28:51 +0200 [thread overview]
Message-ID: <981e8392-6a5e-43ff-afc9-abf49386545f@freedom.nl> (raw)
In-Reply-To: <64D32432-DDCA-4B79-882E-795105BC2532@scorecrow.com>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2024-10-16 20:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 20:47 [NTG-context] " Bernd Donner via ntg-context
2024-10-15 6:47 ` [NTG-context] " Bernd Donner via ntg-context
2024-10-16 17:48 ` Bruce Horrocks
2024-10-16 18:47 ` Hans Hagen
2024-10-16 20:28 ` Hans Hagen via ntg-context [this message]
2024-10-17 14:39 ` Bernd Donner via ntg-context
2024-10-12 7:03 wangzhongtian
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=981e8392-6a5e-43ff-afc9-abf49386545f@freedom.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@freedom.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).