I am testing to determine if two polygons overlap. I have developed a first version which does a simple point in polygon test (Fig 1). However I am looking to revamp that method to deal with situations where no vertices of polygon A are in polygon B but their line segments overlap (Fig B).
Any help getting started would be greatly appreciated.
Here is an example with using Region:
GraphicsPath grp = new GraphicsPath();
// Create an open figure
grp.AddLine(10, 10, 10, 50); // a of polygon
grp.AddLine(10, 50, 50, 50); // b of polygon
grp.CloseFigure(); // close polygon
// Create a Region regarding to grp
Region reg = new Region(grp);
Now you can use the Method Region.IsVisible to determine whether the region is in an Rectangle or Point.