# GraphicsMeshFindIntersections[ ] fails to detect intersections

GraphicsMeshFindIntersections[ ] is an undocumented function for, well, detecting intersections very efficiently. Take a look:

i = Import@"http://i.stack.imgur.com/PcWcz.png";
perim = ImageValuePositions[Thinning@EdgeDetect@i, 1];
fcp = FindCurvePath[perim];
perimPts = perim[[First@fcp]];
GraphicsMeshMeshInit[]; (*not sure if needed*)
myLine = Line@{1.1 {750.5, 955.5}, {182.5, 671.5}};
pts = GraphicsMeshFindIntersections[{myLine, Polygon@perimPts}];
Graphics[{Line@perimPts, Red, myLine, Green, PointSize[Large],
Point@pts}, AspectRatio -> Automatic]


But it doesn't work consistently (here I change myLine):

myLine = {Line@{{750.5, 955.5}, {182.5, 671.5}},
Line@{{622.5, 1031.5}, {222.5, 831.5}}};
pts = GraphicsMeshFindIntersections[{#, Polygon@perimPts}] & /@ myLine;
Graphics[{Line@perimPts, Red, Sequence @@ myLine, Green,
PointSize[Large], Point /@ pts}, AspectRatio -> Automatic]


-
(1. + 2 $MachineEpsilon) already works and (1.-$MachineEpsilon) too (instead of 1.1). How special is this special case? – Rojo Jan 31 '14 at 18:21
@Rojo Not special at all. It fails a lot – Dr. belisarius Jan 31 '14 at 18:26
I've come across this problem before, sadly I know of no way to fix it :-( – Simon Woods Jan 31 '14 at 20:44
@SimonWoods Thanks for letting me know. I was almost thinking I'm the only one! – Dr. belisarius Jan 31 '14 at 21:28
@Rojo see edit, please – Dr. belisarius Jan 31 '14 at 21:46