*On 14/05/2016 at 14:20, ***xxxxxxxx** wrote:

Thank you all for the help that you are providing.

As I have it right now, it is working fine, but I wish I could make it faster. This is the result:

And, the difference between the old method (nested loops) and the new method (search in eight quadrant sub-lists) is as follows:

My current method, is as follows:

• create a list containing just the selected points or all the points if there is no selection.

• from this list, create eight sub-lists, for values of:

-x,-y,-z

-x,-y,+z

-x,+y,-z

-x,+y,+z

+x,-y,-z

+x,-y,+z

+x,+y,-z

+x,+y,+z

• cycle through all the points that are in the initial list (p1).

• based on the signal of the coordinates of the point,calculate the index, to decide what sub-list to use.

• go through all the elements of the sub-list (p2).

• if a distance between p1 and p2 is less than a specific radius, store the points (p1, p2, distance) and leave the inner loop (I just need to find the first point p2 that is close enough to p1).

-----------

Is there any way to make this faster? I can't see how a data structure could improve this :-(