Order List of Neighbors In Counter Clockwise Fashion
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
shan siddiqui
am 3 Mär. 2021
Beantwortet: darova
am 3 Mär. 2021
Hello,
I am trying to generate the natural neighbors of all points in my data set here I have what I am currently doing for one point.
for i=1:3
for j=1:nt
if t(j,i)==5
nn(j,:)=t(j,:);
end
end
end
nn = nn(any(nn,2),:);
nn = unique(nn);
nn = nn(find(nn~=5));
Where t is the delaunay triangulation which is essentially acting as a connectivity list.
This yields the natural neighbors of point number 5 in the data set which I just picked 5 arbitrarily. What I would like is for it to order the coordinates in a counter clockwise manner going around point 5. Like this image:
From there I can compute this same thing for all data sites. Is there also a better way to compute this without the nested for loops I am running to search the Delaunay triangulation?
Thanks
0 Kommentare
Akzeptierte Antwort
darova
am 3 Mär. 2021
Yes, there is one! Look, just get angle of each point and sort it
clc,clear
r = 2+rand(20,1);
t = rand(20,1)*2*pi;
[x,y] = pol2cart(t,r);
[~,ix] = sort(t);
plot(x(ix),y(ix),'.-r')
line(x,y)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Delaunay Triangulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!