# How to order a set of unordered points

6 views (last 30 days)
sparsh garg on 30 Aug 2021
Commented: sparsh garg on 18 Oct 2021
I have a set of unordered points,would appreciate it if some advice can be given on how to reorder them,so that when you draw a line plot the result is continous
Basically,i would like to apply the idea behind RRT.
In RRT,we randomly choose a point,and then find its closest neighbour.We then connect the start point to that neighbour and do tha till we reach the goal.
Given the below img,do you think that idea will work here.
Side note: I have already computed the nearest neigbours for all the points using this,and would appreciate it if we can combine my approach with the one I am talking about in this post.
For ref encosed is the unordered point image as well as the points file

Wan Ji on 30 Aug 2021
Edited: Wan Ji on 30 Aug 2021
Use boundary(x,y) function
x=X_pts(:,1);
y = X_pts(:,2);
k = boundary(x,y,1);
plot(x(k),y(k))
set(gca,'YDir','reverse')
sparsh garg on 18 Oct 2021
Hey wan just wanted to thank you once more for taking the time out to help me.Really learned a lot from you.