I'm trying to come up with a way to order 'random' (poly) lines, knowing only the coordinates of the vertices (and, obviously, which vertices belong to any given line).(adsbygoogle = window.adsbygoogle || []).push({});

I'm not a mathematician or geometrician, but I have a feeling there must be an 'easy' way to do this!

Would probably have to break down the problem something like this:

1) Somehow, calculate a 'direction' for the ordering (e.g., vertical lines could be ordered left-to-right or right-to-left, horizontal lines top-to-bottom or bottom-to-top, polygons inside-to-outside etc.)

2) Decompose the lines to some simplified property (the centroid?) that will put them "in order" along the direction from 1).

Any suggestions gratefully received!

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Robust Algorithm to Order Parallel Polylines

**Physics Forums | Science Articles, Homework Help, Discussion**