On 07/04/2010 01:11 AM, Marco wrote:
Hi Taco!
That is hard. The main problem is the word 'arbitrary'. Sorry, I was too general. The paths are a outline of a relatively simple shape (so border cases should rarely occur) with area>0k, not selfintersecting.
That helps. First test whether the paths insersect, that is easy. If they do insersect, they may still be touching each other only. Still, perhaps that is good enough (depends on what you want to do). But if they do not intersect, then you know for sure that either one is inside the other, or they are totally disjunct. In the fully overlapping case, the boundingboxes of the two paths will most likely likewise overlap perfectly, and that could be good enough for you. Alternatively, if you are certain that both the paths are convex hulls, then just testing for the boundingboxes could be good enough in practice. When the two paths P and Q touch at time A, you could test whether the two points that are time(A+epsilon) and time(A-epsilon) are both inside() both paths. But the hardest thing with doing all this in metapost is that you cannot trust metaposts results in the mathematical sense: rounding errors creep in easily in the internal routines, which is one the problems I hope to solve with metapost 2. Best wishes, Taco