Thursday, June 12, 2008
Sphere Packing with Nvidia's CUDA
While experimenting with Nvidia's CUDA software development kit (an application programming interface designed for general purpose computations) I came across a neat little nugget. There's a sample program (aptly named "particles") that simulates particles in a cube. What I found rather cool was that these particles, left to their own simulated devices, naturally aligned themselves in optimal sphere-packing arrangements, shown above. But not completely! Through random perturbations, they don't line up exactly right; it's more or less prefect, but (like nature) ends up not-so-perfect. 100% cool.