I am wondering how can I solve following problem.
Arrange randomly n points inside a square of the side length a under the condition that the distance between any two points may not be smaller than 1.
I would like to see how can it be solved.
I am wondering how can I solve following problem.
Arrange randomly n points inside a square of the side length a under the condition that the distance between any two points may not be smaller than 1.
I would like to see how can it be solved.
If the points really need to be random, then draw random points and place them in the square if there is not already other points at distance less than 1.
Anyway, at some moment the procedure can start looping forever if there is no room left, but this is difficult to establish.
An approximate solution can be implemented by means of a high resolution image of the square. Every time you place a point, erase the disk around it, and then avoid placing points in an erased area.
You can think of an exact solution, by means of a solution to the "Dynamic Planar Nearest Neighbors" problem, but this can be quite arduous.
nrandom numbers in the selectedaside lenght but I do not know how to make sure that the point-to-point distance between every of then pointswill be always bigger than 1. – Beginner in fort Jul 11 '15 at 15:50