[NTG-context] Metapost: directionpoint gives unexpected point(?)
Mikael Sundqvist
mickep at gmail.com
Fri Feb 12 10:31:21 CET 2021
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 at bittext.nl> wrote:
>
> Hi,
>
> > On 11 Feb 2021, at 17:41, Mikael Sundqvist <mickep at 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 at 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
> ___________________________________________________________________________________
More information about the ntg-context
mailing list