From: Mikael Sundqvist <mickep@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Metapost: directionpoint gives unexpected point(?)
Date: Fri, 12 Feb 2021 10:31:21 +0100 [thread overview]
Message-ID: <CAHy-LL8Qscozy1Av8Vwa_CrN7M2t+q2GTH_dsY8tAGT5oprBQw@mail.gmail.com> (raw)
In-Reply-To: <DD58BD9D-5FDD-404A-9529-A9EA3D6FAD21@bittext.nl>
Hi Taco,
thanks, from your observation and the way I build the paths, I found
out that I can avoid the problem by shortening the paths I join just
slightly:
cl := (fullcircle scaled 4u) shifted z0;
cl := cl cutbefore point (1/6+epsilon) along cl cutafter point
(2/6-epsilon) along cl;
cs := (fullcircle scaled 16u) shifted z1;
cs := cs cutafter point (1/6-epsilon) along cs;
and indeed, it works here now, with different values of the scale u,
and it seems more stable.
/Mikael
PS I found out that eps and epsilon both worked, and I do not see in
the metafun manual if there is a difference.
On Fri, Feb 12, 2021 at 9:35 AM Taco Hoekwater <taco@bittext.nl> wrote:
>
> Hi,
>
> > On 11 Feb 2021, at 17:41, Mikael Sundqvist <mickep@gmail.com> wrote:
> >
> > Thanks for your investigation and extended example!
> >
> > So, if I understand it correctly, the problem occurs where the
> > different circles are glued together with the .. construction.
>
> Took me a while to get it, but the problem is the definition of p0:
>
> p[0] := cs .. cl .. (cs rotated 120) .. (cl rotated 120) .. (cs rotated 240) .. (cl rotated 240) .. cycle;
>
> Here are cs and cl after your earlier definition:
>
> cs := (141.73224999999996,-49.097491614210789)
> ..(75.312386775380347,111.25424516116959)
> ..(28.347427842053655,147.2925755432174);
>
> cl := (28.346108531095332,147.29283827977969)
> ..(0,154.88788322842163)
> ..(-28.346108531095332,147.29283827977969);
>
> Note how the last point of cs and the first point of cl are nearly the same. When you combine these bits into p0, p0 becomes a cyclic path with 18 points (where you really want/need only 12 points).
>
> The micro-segments between these nearly-identical paths are the problem. At smaller u values the differences between the points become zero, and the directionpoint of a path of length zero is mathematically undefined.
>
> I do not know a quick generic solution off hand, but that is what the issue is.
>
> 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
___________________________________________________________________________________
next prev parent reply other threads:[~2021-02-12 9:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 16:48 Mikael Sundqvist
2021-02-05 16:51 ` Mikael Sundqvist
2021-02-11 13:45 ` Mikael Sundqvist
2021-02-11 14:54 ` Hans Hagen
2021-02-11 16:41 ` Mikael Sundqvist
2021-02-12 8:35 ` Taco Hoekwater
2021-02-12 9:31 ` Mikael Sundqvist [this message]
2021-02-12 9:55 ` Taco Hoekwater
2021-02-12 9:53 ` Hans Hagen
2021-02-12 10:03 ` Hans Hagen
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=CAHy-LL8Qscozy1Av8Vwa_CrN7M2t+q2GTH_dsY8tAGT5oprBQw@mail.gmail.com \
--to=mickep@gmail.com \
--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).