Re: I need to locate pore clusters



The problem would be relatively easy if the inclusion criteron were

abs(xi - xj) <= 1.5 && abs(yi - yj) <= 1.5

instead of

sqrt( (xi - xj)^2 + (yi - yj)^2 ) <= 1.5

From your examples, it is not obvious which criterion you want but a fast
way for the first would be:

1. Sort points by x.
2. Form groups by abs(x(i+1)-x(i)) <= 1.5
3. Sort each group of 2. by y.
4. Form subgroups by abs(y(i+1)-y(i)) <= 1.5

Note that if sorted in ascending order, abs() is unnecessary.

For the second criterion, I suppose you could refine these subgroups.




.