I have a function that pulls some lat/longs from a Database and then I put those values in a polygon to see it's shape. The problem is they are so random in position and direction from each other that I get a ton of triangle shapes due to the overlapping. Is there a way to order the positions so I get a solid polygon without the overlapping holes? Tried:
Dim orderedPoints = points.OrderBy(Function(ll) ll.Lng).ThenBy(Function(ll) ll.Lat).ToList
I feel it needs to be drawn in a circular pattern, finding the farthest as it moves around in a given direction. Hoping to not have to reinvent the wheel if poss here. If there is a name for this process I would be more than happy to research it once I know what it is called.
EDIT: Found this for
Convex Hull. Made this code so far. Not sure how to proceed from here.
Public Class ConvexHull Public Function ccw(a As PointLatLng, b As PointLatLng, c As PointLatLng) As Integer Dim area2 = (b.Lat - a.Lat) * (c.Lng - a.Lng) - (b.Lng - a.Lng) * (c.Lat - a.Lat) If (area2 < 0) Then Return -1 If (area2 > 0) Then Return +1 Return area2 ' basically collinear End Function Public Function collinear(a As PointLatLng, b As PointLatLng, c As PointLatLng) As Boolean Return ccw(a, b, c) = 0 End Function End Class