Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 1.08 KB

README.md

File metadata and controls

35 lines (21 loc) · 1.08 KB

This code is a subset of a logistics planning tool, so don't take to much notice of the naming of things.

Given a map polygon based on DD formatted latitudes and longitudes:

New York:

-74.1522217, 40.9249273 -74.1563416, 40.9228521 -74.3554688, 40.5117111 -73.5905457, 40.5524176 -73.6193848, 40.9612339 -74.1522217, 40.9249273

We can then calculates valid points inside that polygon using raycasting.

We do this by first creating a box around the polygon, which is based on the upper and lower highest value in the polygon, and from there asking the raycasting algorithm.

And the raycast

New York

You adjust the distance between the points from the constructor on BoundaryPolygon(0.05).

The lower the distance, the more points you get. Higher, fewer points.

You can find the tests for these cases in GeoPointExtensionsTests.cs.

Besides those methods there is a method for determining distance between 2 points on a map, using the Haversine formula.

Those tests are found in DistanceCalculatorTests.cs.