PolygonF
A class that wraps a PointF[] representing a Polygon. The class members include:
- RectangleF Bounds
- float MinimumX
- float MaximumX
- float Minimum Y
- float Maximum Y
- int NumberOfPoints
- bool IsInBounds(PointF pt)
- bool Contains(PointF pt)
- PointF CenterPointOfBounds
- PointF CenterPoint // Not yet implemented
- decimal Area
IsInBounds returns true if the PointF is within the Rectangular Bounds of the Polygon. Contains returns true if the PointF is actually within the Polygon’s borders.
The class includes both the PolygonF and Polygon classes. Polygon is identical to PolygonF except that it works with an array of Point objects and return ints instead of floats.
First introduced on the blog under Testing to see if a Point is within a Polygon.
THANK YOU
You’re welcome!
Thank you for your class. I’m using it on my Open Source project. I credited you by adding this blog link on our About dialog.
Regards,
Patricio.
Thanks Patricio, I hope it is helpful!
Thanks – This code is great!
code link is dead