Reverse a polygon's orientation in C#
Reversing a polygon's orientation is easy. Simply reverse the order of its points. If the points are stored in an array of Point or PointF, you can call the Array.Reverse method.
The OrientPolygonClockwise function checks a polygon's orientation and reverses it if it is not already oriented clockwise.
// If the polygon is oriented counterclockwise,For more on polygon orientation, see Determine whether a polygon's points are oriented clockwise in C#.
// reverse the order of its points.
private void OrientPolygonClockwise()
{
if (!PolygonIsOrientedClockwise())
Array.Reverse(Points);
}



Comments