[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Perform geometric operations on polygons in C#

Geometric operations for polygons

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.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.