Polygon Collision Testing / Polygon Overlap Test in C# - Not Point in Polygon

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.

Need Your Help

getIntExtra() and putExtra()?

android android-intent

I read Hello Android book and i dont understan the following code.

Is there a better way to implement “Custom” Business Validators?

c# winforms syntax user-controls c#-3.0

I have a user control and I want the developer who drops the user control on the winform, can tests some values before this user control does something

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.