Hello,
I am wondering if it is possible to divide a list of points into sublists, where points are sorted into the sublists by distance between them.
For example I have this list of random points:
15.0, 18.0;
16.0, 9.0;
11.0, 12.0;
12.0, 12.0;
16.0, 3.0;
17.0, 3.0;
10.0, 6.0;
5.0, 15.0;
6.0, 15.0;
16.0, 2.0;
17.0, 2.0;
1.0, 3.0;
2.0, 3.0;
17.0, 9.0;
16.0, 10.0;
1.0, 2.0;
2.0, 2.0;
6.0, 7.0;
10.0, 7.0;
11.0, 7.0;
5.0, 8.0;
6.0, 8.0;
5.0, 7.0;
5.0, 16.0;
6.0, 16.0;
14.0, 18.0;
17.0, 10.0;
11.0, 11.0;
12.0, 11.0;
11.0, 6.0;
14.0, 19.0;
15.0, 19.0;
And here is a needed output, where distance between points in a sublist is 1.0 (in both directions X and Y):
{1.0, 2.0; 2.0, 2.0; 1.0, 3.0; 2.0, 3.0}
{16.0, 2.0; 17.0, 2.0; 16.0, 3.0; 17.0, 3.0}
{10.0, 6.0; 11.0, 6.0; 10.0, 7.0; 11.0, 7.0}
{5.0, 7.0; 6.0, 7.0; 5.0, 8.0; 6.0, 8.0}
{16.0, 9.0; 17.0, 9.0; 16.0, 10.0; 17.0, 10.0}
{11.0, 11.0; 12.0, 11.0; 11.0, 12.0; 12.0, 12.0}
{5.0, 15.0; 6.0, 15.0; 5.0, 16.0; 6.0, 16.0}
{14.0, 18.0; 15.0, 18.0; 14.0, 19.0; 15.0, 19.0}
I’ve attached an image to visualize my question.
The language doesn’t matter - I just can’t start with the logic. If it’s important, I am working in C#.
Thank you in advance for any ideas!