Poor man's sphere packing in 3D

39 Views Asked by At

Given a predicate $p:\mathbb{R}^3\rightarrow \{0,1\}$ that defines a contiguous region in space (cieLAB in my particular case), and a number $n\in\mathbb{N}$ that defines the number of points $x_i\in\mathbb{R}^3$ to be sampled from the space, how can we sample the points in such a way that $p(x_i)=1 \forall i\in \{1,2,...,n\}$ while trying to maximize $\min_{i\neq j} ||x_i-x_j||$ i.e. the distance between points.

I'm seeking a simple algorithm to get a reasonable solution, even if it isn't the optimal solution.

So for example: if we start with $n$ initially random points in the space, how can we greedily refine them with a simple algorithm?

1

There are 1 best solutions below

0
On

If you can loose your criteria, you may create an interaction potential between points (usually a $r^{-1}$): $$ U=\sum_{i>j}\frac{1}{|x_i-x_j|},\qquad \nabla_{x_i}U=-\sum_{j\neq i}\frac{x_i-x_j}{|x_i-x_j|^3} $$ and minimize $U$ it using any of gradient descent methods. The only thing you have to change is that you reject step for point $i$, if it goes out of the region (you can also decrease the step size after it).

If you don't want to loose the criteria, then you should only move points that are closer to each other.