Title: Perform geometric operations on polygons in C#
This example contains a Polygon class that perform several useful geometric operations for polygons. The following list describes the key methods provided by the class. Click the links to see posts that describe the methods in greater detail.
To use the example, click to add points to the polygon. Then use function keys or the menu to perform the operations.
The "Point in Polygon" test is a bit odd because it uses the mouse's current position as the point you want to test. If you use the menu item to perform the test, the point is wherever the menu item is. To test points without using the menu, press F3.
Note also that the Bounding Rectangle operation only works for convex polygons. (You can convert a non-convex polygon into a convex one by finding its convex hull.)
Download the example to experiment with it and to see additional details.
|