Sphere Packing - Radius change Dynamically

Hi @DanielPiker

I have done a research on the forum but apparently it has not been asked before.
Is there a “quick way” to do a sphere packing on a volume in the same way we do for the circle packing?

Let’s say that I have a volumetric field and I want the sphere to adapt to the stress when they get close to a low value field or get bigger to an high value field (same as circle packing based on image basically)

I have red this thread but it is not really want I am looking for.

I am pretty sure that it is possible but before I start writing some code, I am wondering if you are interested in sharing your solution first

2 Likes

Hi @mp1

See my reply here for some previous work on this

That project is fairly complex though, and if you just want spheres of different sizes things can be much simpler as you just have scalars to interpolate instead of the tensors for orientation and anisotropy.

The key bit is how you want to input your radius field. Do you have values at regular grid points?

2 Likes

meshstack_spherepack2.gh (17.8 KB)

As a quick way using only existing components without scripting, you can also simply create a stack of coloured meshes (or rather a single disjoint mesh).

It should be fairly quick to make a new goal that would let you actually input a grid of points and values though for if you need also vertical interpolation of values instead of just closest in a discrete sampling as happens with this mesh stack approach. It could also optionally include collision with a boundary mesh, for if you wanted the spheres inside the volume, instead of just their centers inside.

2 Likes

Hi @mp1
This is my last result on this discussion, I’ve been able to control the sphere radius everytime kangaroo complete a cycle with anemone.

Here the problem are:

  1. Correct number of spheres (Open problem > Variable to control)
  2. Computationally expensive with high numbers of spheres.

Packing with attractor 2.gh (99.4 KB)

3 Likes

I also posted recently an example of circle packing with adaptive radius, so the sizing is adjusted inside the goal calculation itself, which I think is a lot faster than what you’d get by putting the whole solver in some external loop.

That was for equal radius, but I think could probably be adapted to adjust a global multiplier for a range of radii from some image or 3d field.

1 Like

The idea is to have a scalar field (points - values) and try to pack as much sphere as possible.

I already had a look at some of your previous work but I was wondering if it could be easier for a “sphere” case.

I attach a .gh script in case you want to give it a go