# Help filling a tube with spheres and work when resizing tube / sphere

Hi All,

``````Below is the playground link I created.
``````

I am new to Babylon and I am trying to fill a tube with sphere and when
I increase the size of sphere / tube it should fill but never protrude out of tube
any help on the same would be great…

rgds
Balaji

I am not sure to fully understand what you are trying to achieve but maybe @JohnK a maths superhero will be able to help ?

@Balaji_K
Where r is radius of sphere and R the radius of the tube do you mean when

1. r = R or
2. 0.5R < r < R or
3. r = 0.5R or
4. r < 0.5R or
5. 0 < r <= R
1 Like

@JohnK its 5 , I did played around with Sin theta and cos theta and was able to get it within the circle. But the problem is some spheres just protrude a little out of the tube…

Sphere packing within a cylinder is a complex task

You can think of the bottom layer of sphere fitting in the same way as fitting smaller circles with a larger circle - again complex

2 Likes