One possibility:
Estimate the center of the polygon with the mean of the x coords and
the mean of the y coords.
Calculate the angle of each point from that center point using the
atan2 function
sort the data by the angle calculated.
This will not be perfect if you have inlets and peninsulas, but would
at least get you started and those points could be adjusted by hand or
by an algorithm that looks for crossings/self-intersections and
reverses the order of the points that cause the cross.
On Tue, Oct 23, 2012 at 11:50 AM, peleve <pitiur at gmail.com>
wrote:> Hello,
>
> I have the contour of the shoreline of a lake. I have measured data points
> away from the lake shore signifying a particular depth. The data is not
> ordered as a polygon and hence trying to draw it creates a series of lines
> all over the place. I would like to turn the points into a ordered set that
> results in a smooth polygon.
> I have tried a "nearest point" approach. An example is shown
here:
> http://www.deepcreekanswers.com/samples/sampledata.png.
> I've tried a closest perpendicular distance to the shoreline polygon
> elements approach. But it's worse.
>
> Does anyone have an approach that might work?
>
> Thank you a priori.
>
> Pete Versteegen
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Creating-a-polygon-from-an-unordered-set-of-points-tp4647181.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com