On 22 Apr 2020, at 09:30, Taco Hoekwater
wrote: Hi,
On 21 Apr 2020, at 17:52, Gerben Wierda
wrote: pair a ; a := arrowHead intersection_point connection ;
Hans’ example also works with “intersectionpoint”: the differences between intersectionpoint and intersection_point are minimal except if there is no intersection at all.
The trick is that Hans does not use cutafter. cutafter is designed to cut off as little as possible, it is a cutbefore on both paths reversed. So, uses the last intersection point of the paths, and in this case it will therefore use the top of the arrowhead.
In contrast, intersectionpoint finds the first intersection on the non-reversed paths, which is the base of the arrowhead.
Alternatively (in this case), you could move the arrowhead up a tiny amount, so that there is only one intersection between the connection and arrowHead.
In fact I did something like this, except that I first shortened the line path so it ends in the middle of the triangle before doing a cutafter (twice in both directions and taking the one which cuts the most). This works reliably. I gave up on another approach (which repeatedly cut a little bit from the path until it wasn’t intersecting anymore, then taking the one form thelast successful intersection) as I also have paths that connect a path-cycle to itself. A ‘cut until it just doesn’t intersect anymore' would eat up the entire path in that case until only a single point is left. G
Best wishes, Taco ___________________________________________________________________________________ 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 ___________________________________________________________________________________