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)
Ältere Kommentare anzeigen
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
Antworten (1)
Bruno Luong
am 27 Feb. 2023
Formulate as TSP and solve with intlinprog as showed here
4 Kommentare
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.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!