[NTG-context] Metapost: directionpoint gives unexpected point(?)

Taco Hoekwater taco at bittext.nl
Fri Feb 12 09:35:13 CET 2021


> 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)
cl := (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,

More information about the ntg-context mailing list