This function can help you sort the Delaunay Triangulation in Nx2 connectivity matrix in ascending order. It will find the 2nd, 3rd, 4th and 5th neighbors of the points. It is defined as:
[DelaunayT] = delaunaytrianglecalc(X,Y) - where 'X' and 'Y' are the defined inputs and represent the point coordinates.
The output 'DelaunayT' is a structure that will give you the following:
Delaunay Triangles (N x 3 matrix)
Delaunay Connectivity (N x 2 matrix)
2nd Neighbor Connectivity (N x 2 matrix)
3rd Neighbor Connectivity (N x 2 matrix)
4th Neighbor Connectivity (N x 2 matrix)
5th Neighbor Connectivity (N x 2 matrix)]
Example (for up to 3rd neighbor):
X = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]';
Y = [0.1 0.4 0.3 0.6 0.1 0.9 0.4 0.2 0.8]';
[DelaunayT] = delaunaytrianglecalc(X,Y);
Points: [9x2 double]
DelaunayTriangles: [10x3 delaunayTriangulation]
DelaunayConnect: [18x2 double]
Neighbour2nd: [16x2 double]
Neighbour3rd: [2x2 double]
Andrej (2021). Delaunay Triangulation with 2nd, 3rd, 4th and 5th Neighbor (https://www.mathworks.com/matlabcentral/fileexchange/63702-delaunay-triangulation-with-2nd-3rd-4th-and-5th-neighbor), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!