Author: Michael Cammer firstname.lastname@example.org History: 20150707 shortest_and_2nd_shortest_v100.txt see explanation below. Source: (see below) Installation:
It's just a macro. Plugins > Macros > Install...
Or open as a text file and install or run from the menu at the top of the window.
The ultimate goal is to use this macro to find clusters of points in 2D space. Yes, it has the limitation of the edges of the image so likely only useful for whole objects or surfaces where there are natural boundaries.
The algorithm is to find the shortest and 2nd shortest distances between all pairs of points. The next steps would be to apply criteria to sever connections of the 2nd shortest (or 3rd or 4th shortest, if they are saved too; they are calculated but not pulled in the Array.rankPositions(dist) step) such as based on greater than 15% of average distance.
shortest_and_2nd_shortest_v100.txt is the first version which only calculates the distances of all pairs. Putting these rankings into arrays for later processing still needs to be coded.
And here are examples of 3 shortest connects with points added & subtracted. shortest_and_2nd_and_3rd_shortest_v100.txt
Next is the hard part of sorting, grouping, convex hull, etc.
|Macros | Home |