ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerben Wierda <gerben.wierda@rna.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: METAPOST: How do I get this 'max' cutafter to work?
Date: Wed, 22 Apr 2020 22:12:36 +0200	[thread overview]
Message-ID: <741F55CB-2DAF-4B6D-B56A-91F1E8E34C01@rna.nl> (raw)
In-Reply-To: <C8E6C179-600D-4580-B9AA-344935206914@elvenkind.com>

> On 22 Apr 2020, at 09:30, Taco Hoekwater <taco@elvenkind.com> wrote:
> 
> Hi,
> 
>> On 21 Apr 2020, at 17:52, Gerben Wierda <Gerben.Wierda@rna.nl> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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
___________________________________________________________________________________

      parent reply	other threads:[~2020-04-22 20:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 11:29 Gerben Wierda
2020-04-21 12:41 ` Hans Hagen
2020-04-21 15:52   ` Gerben Wierda
2020-04-21 16:25     ` Hans Hagen
2020-04-22  7:30     ` Taco Hoekwater
2020-04-22  8:17       ` luigi scarso
2020-04-22 20:12       ` Gerben Wierda [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=741F55CB-2DAF-4B6D-B56A-91F1E8E34C01@rna.nl \
    --to=gerben.wierda@rna.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).