I am counting the number of collisions of a very large number of particles, and I want to divide the space with many spheres, intersecting one with the other.
I have already managed to divide the space in cubes. By taking the coordinates of the particles, dividing them with the cube size and flooring them, I then compute the number of collisions. In the 2D case:
given x_coordinate and y_coordinate
xi = math.floor(x_coordinate/cube_size)
yi = math.floor(y_coordinate/cube_size)
for each particle belonging to the same cube:
compute probability of collision
I want now to divide the space in spheres, by circumscribing the sphere to the cube, like this (2D case for simplicity): 2D binning with circles.
The problem is that now the spheres intersecate, so it is way too complex with respect to the cubes division. On the other hands the solution given with the cube is very elegant and I want to find a way to exploit it for the sphere approach.