I may have discovered a bug in MetaPost and MetaFont but before I report it, I'd like to make sure it really is a bug.

From an intuitive point of view I'd expect that if two paths have an intersection point, then there should be an intersection of one of these paths and the reverse of the other path.

However, the following MetaPost/MetaFont program show MetaPost/MetaFont beg to differ.

path pa, pb; pair ta, tb;

pa = (6.51782,19.85922)..controls (1.38812,14.72952) and (-1.67604,7.1873)
         ..(-1.67604,-0.64035)..controls (-0.65317,-0.04979) and (0.36969,0.54076)
         ..(1.39256,1.13132)..controls (1.39256,8.95897) and (4.8107,15.6466)
pb = (-1.67339,-0.64497)..controls (-1.57977,-0.80708) and (-1.48618,-0.96921)
         ..(-1.39256,-1.13132)..controls (-1.39256,-0.91154) and (-1.39026,-0.69205)

ta = pb intersectiontimes pa;
tb = (reverse pb) intersectiontimes pa;

show ta; % (1.99997,1.09459), so there's an intersection
show tb; % (-1,-1), so there's no intersection


Am I missing something?

  • I notice that the intersection point in the first case is point infinity of pb - perhaps MP rounds differently at the beginning of a path than at the end? – Thruston Dec 23 '14 at 20:13

For the record, Jacko (I don't know if he wrote you) has constructed a simpler example from your original, and we plan to ask Knuth to look at the issue when he next looks at the accumulated bug reports (next year). We have no answer to the actual question :(. --best, karl (at tug dot org).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy