[NTG-context] troubles with cutafter
Taco Hoekwater
taco at elvenkind.com
Tue Oct 27 15:23:27 CET 2020
> On 27 Oct 2020, at 14:06, Damien Thiriet <damien at thiriet.web4me.fr> wrote:
>
> Hello,
>
>
> I went into some troubles with cutafter.
> Must have missed something obvious.
Not so obvious: due to rounding/precision errors, the result of “intersectionpoint”
is rarely the actual point. It finds a point “close to” the actual intersection
of the two paths.
The intersectionpoint calculation works by limited recursive bisection of the two paths,
and thus it finds imprecise results in all but the most trivial cases. The result may
be an actual point on p1 or p2, or on both, or even on neither.
The better solution is to use intersectiontimes and subpath:
draw subpath (0, xpart (p1 intersectiontimes p2)) of p1 withcolor red;
Best wishes,
Taco
More information about the ntg-context
mailing list