GeoFenceOrderPoints_RightHanded Method

Orders the points of the GeoFence to be right-handed (counterclockwise). This method is typically used for the outer boundary of a polygon, following the GeoJSON specification, where the outer boundary is represented with right-handed (counterclockwise) orientation.

Definition

Namespace: CoordinateSharp
Assembly: CoordinateSharp (in CoordinateSharp.dll) Version: 3.1.1.1
XMLNS for XAML: Not mapped to an xmlns.
C#
public void OrderPoints_RightHanded()

Return Value

Returns the GeoFence instance with points ordered in a right-handed (counterclockwise) direction.

Remarks

A polygon is considered right-handed if its points are ordered in a counterclockwise direction. This method rearranges the points in the GeoFence to ensure a counterclockwise orientation.

Example

Example usage:
C#
// Create a GeoFence with points in arbitrary order
List<Coordinate> points = new List<Coordinate>()
{
    new Coordinate(47.6062, -122.3321),  // Seattle
    new Coordinate(48.7519, -122.4787),  // Bellingham
    new Coordinate(47.2529, -122.4443),  // Tacoma
    new Coordinate(48.0419, -122.9025),  // Port Townsend
};
GeoFence outerFence = new GeoFence(points);

// Order the points to be right-handed (counterclockwise)
outerFence.OrderPoints_RightHanded();

// Verify the points are ordered correctly and close the polygon
outerFence.ClosePolygon();

// The GeoFence is now ready to be used as an outer boundary in a GeoJSON polygon

See Also