Sorting random x,y spots on circularly closed line in order to calculate properly the perimeter and the area of the polygonal shape.

2 Ansichten (letzte 30 Tage)
I want to sort random x,y spots on circularly closed line in order to calculate properly the perimeter and the area of the polygonal shape. I haved attached the images which i hope help me to be more specific:
  • random spots
  • after the unsorted line created from them
  • the sorted line from matlab which of course not help us
  • and the human sort plot that i make the sort by myself and the target sort
Is there any way to sort them like that or i need to recreate the way i was collected them and i was stored?
  5 Kommentare
ALEXANDROS
ALEXANDROS am 27 Feb. 2023
Bearbeitet: ALEXANDROS am 27 Feb. 2023
yes i was try to edited in order to be more specific but anyway... the shape of random spots plot that i showed it was an extremely example of my problem. The route that the line make the closed loop usually is only one, so the only problem is a way to sort them in order to follow a circularly line loop.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Bruno Luong
Bruno Luong am 27 Feb. 2023
Formulate as TSP and solve with intlinprog as showed here
  4 Kommentare
John D'Errico
John D'Errico am 27 Feb. 2023
Bearbeitet: John D'Errico am 27 Feb. 2023
Actually, a TSP solver will not cross edges. Why not?
Suppose you have some configuration of points where you think the solution has crossed edges? Then you can always change the sequence in a way that has the edges uncrossed, AND has a lower total distance.
A TSP is the correct way to solve this problem, at least if the goal is to find the minimal polygon connecting the points.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by