Fix poly_ContourInContour() test not to return TRUE for touching contours
commitbbe5aa52e540171a08f905e38468623a0d3f2e1c
authorPeter Clifton <pcjc2@cam.ac.uk>
Mon, 10 May 2010 16:40:15 +0000 (10 17:40 +0100)
committerPeter Clifton <pcjc2@cam.ac.uk>
Tue, 11 May 2010 15:00:18 +0000 (11 16:00 +0100)
treedd9c43bbf4d30324d759b1420515220a48c4c1af
parent4ba4e750b297d860a1264a59d3e418dfc9a6c635
Fix poly_ContourInContour() test not to return TRUE for touching contours

This test could previously return true for touching contours, such as:
 __________....
|_________ |  :
:........ ||  :
::  /\  : ||  :   Note that the bounding box of A is inside that of B,
:: /  \ :/  \ :   such that initial bounding box checks won't reject the
::/ A  \/  B \:   possibility of A being inside B.
::\    /\    /:
:: \  / :\  / :
::..\/..:.\/..:

When testing for insideness, the first point on A's contour is picked.
In this case, unfortunately being the touching X point between the two
contours. This point (correctly) returns as being inside B - and the
false presumption is that the whole A contour is inside B.

This commit introduces an unfortunately slow, but more robust test,
where we check each node in A for whether it is inside B. We return
as soon as we find an A node outside B, however this means the test
is VERY much slower for the case where A _is_ inside B.
src/polygon1.c