The goal: ability to create dense clusters of non-overlapping paths.
The progress so far: using intersects() function it is easy to check for overlap. Certain gain in speed is possible by placing intended paths on temporary spiral path (Archimedian spiral works well).
The problem: It takes too long for the script to check 100 or more objects.
The core of the problem: The script checks for overlap with ALL previously created paths, instead of discarding the areas where overlap is certain.
Possible solution: Create array of all previous placed path positions and sort it, note the size of largest possible path, when checking for overlap note the position of the last path and check the array for other paths withing the radius derived from the size of the largest object. Check overlap with only those paths.
Help: while the possible solution may work, I am not familiar enough with JavaScript to quickly test it. I will appreciate any advise or additional clues on how to approach the problem.