From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Gerben Wierda <gerben.wierda@rna.nl>
Subject: Re: METAPOST: How do I get this 'max' cutafter to work?
Date: Tue, 21 Apr 2020 14:41:27 +0200 [thread overview]
Message-ID: <4d3f3d4b-21b5-a05c-1c11-6f822b1e566b@xs4all.nl> (raw)
In-Reply-To: <380159EC-C3C3-44E3-87A7-17401755BF0B@rna.nl>
On 4/21/2020 1:29 PM, Gerben Wierda wrote:
> I have these two paths, but cutting doesn’t work because the path to be
> cut takes the wrong intersection regardless of how I direct the path to
> be cut after (reverse or not).
>
> The path to cut after is a triangle with the base horizontal and the
> path to cut is a vertical line. The top of the triangle is the endpoint
> of the line and is selected as intersection by cutafter. This happens
> also if I reverse the triangle path, strangely enough. I have an
> alternative cutting algorithm, but that cuts as long as the length of
> cuttings is not 0, which is the case at the top too, so it won’t cut
> further.
>
> I need a reliable algorithm to make a ‘maximum cutafter’. What might be
> a good approach?
>
> G
>
> path arrowHead;
> arrowHead :=
> (542,-77.000186920166016)..controls
> (545.33333333333337,-77.000186920166016) and
> (548.66666666666663,-77.000186920166016)
> ..(552,-77.000186920166016)..controls
> (550.33333333333337,-73.666853586832687)
> and (548.66666666666663,-70.333520253499344)
> ..(547,-67.000186920166016)..controls
> (545.33333333333337,-70.333520253499344)
> and (543.66666666666663,-73.666853586832687)
> ..cycle;
>
> path connection;
> connection :=
> (420.00004959106445,-367)..controls (420.66670256708773,-367) and
> (421.333355543111,-367)
> ..(422.00000851913427,-367)..controls (425.33333917170194,-367) and
> (428.6666698242696,-367)
> ..(432.00000047683727,-367)..controls (442.00000015894574,-367) and
> (451.99999984105426,-367)
> ..(461.99999952316273,-367)..controls (464.76142345324098,-367) and
> (467,-364.76142382108867)
> ..(467,-361.99999997656772)..controls (467,-293.99999999218926) and
> (467,-226.00000000781074)
> ..(467,-158.00000002343228)..controls (467,-155.23857623850762) and
> (469.23857634039018,-153)
> ..(472.00000014901161,-153)..controls (495.33333338300389,-153) and
> (518.66666661699617,-153)
> ..(541.99999985098839,-153)..controls (544.76142368504975,-153) and
> (547,-150.76142367339932)
> ..(547,-147.99999983662815)..controls (547,-125.99999994554271) and
> (547,-104.00000005445727)
> ..(547,-82.000000163371837)..controls (547,-78.666668047283764) and
> (547,-75.333335931195691)
> ..(547,-72.000003815107618)..controls (547,-70.333398183460417) and
> (547,-68.666792551813217)
> ..(547,-67.000186920166016);
>
> show connection cutafter arrowHead;
> show connection cutafter (reverse arrowHead);
\startMPpage[instance=doublefun]
path arrowHead;
arrowHead :=
(542,-77.000186920166016)..controls
(545.33333333333337,-77.000186920166016) and
(548.66666666666663,-77.000186920166016)
..(552,-77.000186920166016)..controls
(550.33333333333337,-73.666853586832687) and
(548.66666666666663,-70.333520253499344)
..(547,-67.000186920166016)..controls
(545.33333333333337,-70.333520253499344) and
(543.66666666666663,-73.666853586832687) ..cycle;
path connection;
connection :=
(420.00004959106445,-367)..controls (420.66670256708773,-367) and
(421.333355543111,-367) ..(422.00000851913427,-367)..controls
(425.33333917170194,-367) and (428.6666698242696,-367)
..(432.00000047683727,-367)..controls (442.00000015894574,-367) and
(451.99999984105426,-367) ..(461.99999952316273,-367)..controls
(464.76142345324098,-367) and (467,-364.76142382108867)
..(467,-361.99999997656772)..controls (467,-293.99999999218926) and
(467,-226.00000000781074) ..(467,-158.00000002343228)..controls
(467,-155.23857623850762) and (469.23857634039018,-153)
..(472.00000014901161,-153)..controls (495.33333338300389,-153) and
(518.66666661699617,-153) ..(541.99999985098839,-153)..controls
(544.76142368504975,-153) and (547,-150.76142367339932)
..(547,-147.99999983662815)..controls (547,-125.99999994554271) and
(547,-104.00000005445727) ..(547,-82.000000163371837)..controls
(547,-78.666668047283764) and (547,-75.333335931195691)
..(547,-72.000003815107618)..controls (547,-70.333398183460417) and
(547,-68.666792551813217) ..(547,-67.000186920166016);
pair a ; a := arrowHead intersection_point connection ;
draw connection cutafter arrowHead withcolor red withpen
pencircle scaled 2mm ;
draw connection cutafter (reverse arrowHead) withcolor green withpen
pencircle scaled 1mm ;
draw arrowHead;
draw a withcolor blue withpen pencircle scaled 3mm ;
currentpicture := currentpicture shifted (-bbwidth(currentpicture), 0) ;
draw connection cutafter a ;
draw arrowHead;
\stopMPpage
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2020-04-21 12:41 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 [this message]
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
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=4d3f3d4b-21b5-a05c-1c11-6f822b1e566b@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=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).