GeoFenceOrderPoints_LeftHanded Method

Orders the points of the GeoFence to be left-handed (clockwise). This method is typically used for inner boundaries (holes) in a polygon, following the GeoJSON specification, where holes are represented with left-handed (clockwise) 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_LeftHanded()

Return Value

Returns the GeoFence instance with points ordered in a left-handed (clockwise) direction.

Remarks

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

Example

Example usage:
C#
// Create a GeoFence with points in arbitrary order
List<Coordinate> points = new List<Coordinate>()
{
      new Coordinate(46.8523, -121.7603),  // Mount Rainier (center point)
      new Coordinate(46.8625, -121.7401),  // Slightly north-east
      new Coordinate(46.8421, -121.7805),  // Slightly south-west
      new Coordinate(46.8650, -121.7850),  // North-west
      new Coordinate(46.8400, -121.7500)   // South-east
};
GeoFence innerFence = new GeoFence(points);

// Order the points to be left-handed (clockwise)
innerFence.OrderPoints_LeftHanded();

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

// The GeoFence is now ready to be used as an inner boundary (hole) in a GeoJSON polygon

See Also