On Saturday 03 July 2010 10:03:32 Taco Hoekwater wrote:
On 07/02/2010 07:01 PM, Marco wrote:
Hi,
two arbitrary paths are given. A small path and a larger path, both cycled. How to find out if the smaller path lies completely »inside« the larger path?
That is hard. The main problem is the word 'arbitrary'. An arbitrary path does not even have to enclose anything:
path p; p = origin--(100,100)--cycle;
If this is too complicated, it might help if I can find out if a given point lies inside a given cycled path.
Even this is fairly tricky. Some important questions are:
* do your arbitrary paths selfintersect? * are your arbitrary paths convex or concave? * is a point *on* the path in or out? * do you want to use nonzero or even-odd filling rules?
Best wishes, Taco
OK, this is off-topic (and not very useful as an answer)... but is something to think about: ``posito tendendum esse a puncto ad punctum, licet nihil ultra iter determinat, via eligetur maxime facilis seu brevissima;'' Leibniz: De rerum originatione radicali, 1697 ``suppose that we are to go from one point to another, without being directed to follow a particular path, the path chosen will be the easiest or the shortest one;'' So, in a Cartesian space, if the energy cost of a kink is low, than
path p; p := origin--(100,100)--cycle; should be a straight line running back on itself. Indeed, this is what metapost produces.
Now try p := origin..(100,100)..cycle; Alan