Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2011-01-13 16:22:52

abhor_ennui
Member
Registered: 2006-11-08
Posts: 3

Cube-Sphere Packing

I've got a program im coding up and I can't come up with the math behind what I need it to do nor can I find anything similar that helps.

What im trying to create is a sphere comprised of cubes.
This picture shows what im trying to get very well:   http://techboard.nemetschek.net/ubbthreads.php?ubb=download&Number=4381&filename=Sphereofcubes_Iso.jpg
The picture only shows one layer of cubes to form a sphere however.  What I'm going for is multiple layers.  So the problem im having is coming up with some formula to calculate the optimal packing of cubes( how many cubes per a layer assuming the cubes are just 1x1x1) to form a layer of a sphere for any nth layer or radius of sphere. I can find the math on other kinds of packing, this specific problem I can't seem to find anything similar to it on the interwebs. Other then that im not sure how to approach making a formula for this. Any help or shove in the right direction would be much appreciated.

Last edited by abhor_ennui (2011-01-13 16:30:49)

Offline

#2 2011-01-14 12:58:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Cube-Sphere Packing

Hi abhor_ennui

Welcome ro the forum.

I have found very little in 2 days on your problem. Someone has said that it is between 400 and 500 cubes to make a sphere. Does that sound right to you? I mean is it close at all?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2011-01-14 15:09:27

abhor_ennui
Member
Registered: 2006-11-08
Posts: 3

Re: Cube-Sphere Packing

I can't find anything similar to it either. 400 and 500 cubes for a sphere of what radius or how many layers of unit cubes?  I would think there would be some way with a geometric series or some other series to model how many cubes there would be effeciently packed per any Nth sum.  I'm going to try manually creating layers in something like Google Sketchup and try to create a series off of that, but I would think there would be some way to just work it out on paper with unit cubes and geometry.

When I logged in the other day it showed my last visit as being in 2006! I know I had an account before then when I was actually actively participating in this wonderful forum but yeesh that was ages ago.

Offline

#4 2011-01-14 15:18:01

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Cube-Sphere Packing

The size would depend on the size of the cubes but looking at your drawing and attempting to count and estimate I would say that maybe 200 or 250 would be accurate for half a circle.

It looks like your second drawing is 10 cubes in diameter. So the volume of that sphere would be 523. Meaning that if it were entirely packed by 1x1x1 cubes it could hold 523 of them . This is an upper bound, since your sphere is not that tightly packed 400 -  500 cubes seems reasonable.

but I would think there would be some way to just work it out on paper with unit cubes and geometry.

If such a method were not possible then an upper bounds is the next best thing.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#5 2011-01-16 09:12:07

4DLiVing
Member
Registered: 2011-01-08
Posts: 22

Re: Cube-Sphere Packing

hi abhor_ennui

Here is an idea for you.  I have not figured out how to generalize it, but hopefully it will put you on the path you are looking for.

As you increase the number of sides of a regular polygon, it looks more and more like a circle.

So, you can choose a regular polygon, put it on an xy-plane, then rotate it around the y or x axis.  You can use the inscribed circle of the regular polygon as your guide for the spherical shape of your cubes.

If you make the side lengths 1 of your regular polygon, then it is not too far of a stretch to picture cubes when rotating around the y-axis.

Here is an example using a regular ocatgon(see attached image)                                   

For any regular polygon, with a side length of 1, the radius of the inscribed circle for n sides is...

for an octagon...

and the circumference of the inscribed circle of an octagon will be...

The arc length between the center points of two of your cubes on this circle is

.

So you know that for approximately each .948 of the circumference of a circle, you will have one cube.

With a little work, you can find

and the circumference of the circle after rotation, with D1 as its diameter will be

this tells us that you will be able to fit 5 cubes around this part, with .622736878 of circumference left that you can divide evenly between all of the cubes so spacing is equal.

The middle diameter is the same as the circle and will fit 8 cubes around it.

So, when its all said and done, after rotating around the axis of rotation, you will have 1 cube on the top, 5 under it, 8 in the middle, 5 under that, and 1 on the bottom, giving you a total of 20 cubes using this method.

I hope I was clear and gave you some ideas as to how to approach this!

Last edited by 4DLiVing (2011-01-16 09:13:19)

Offline

#6 2011-01-18 07:50:57

abhor_ennui
Member
Registered: 2006-11-08
Posts: 3

Re: Cube-Sphere Packing

Howdy 4dLiVing!

Thank you much for this contribution to the solution of my problem! I'm going to try this method here momentarily as it seems like good way to try things. It will take me awhile to code everything up to see if things will work out how I need them to. My prior attempts used a much different process atleast code wise hence it will take some time. 

In the time since I last posted I got frustrated with the math and decided to do it the brute force way( let the computer try a lot of combinations instead of doing the math for the optimal solution).  The result was this:

See Uploaded Image*

Sorry if the image is rather low quality... scrot is messing up capturing the screen in the opengl window(no idea why).
I accomplished this rendering by following this general method:  Do everything in spherical coordinates( I don't know why I didn't think of that awhile ago!). Then by just incrementing theta's and phi's for each ring of cubes and checking for collisions, I get the shown rendering.  The gaps in each ring is caused by there not being enough room for another cube in said ring of cubes. The only way to fix this I can think of is just spacing out that gap equally across the ring... but thats not really what I want in the end.

This method of brute forceing... may or may not work efficiency wise. I'm definitely going to work out 4dLiVing's suggestions to see if I can get that way to work because of efficiency. With this brute force method this particular rendering is with a distance of r=50 from the origin of the sphere and it's only half of the sphere and only the layer of cubes at r=50.  It took approx  10 seconds to run everything... which isn't terrible. But when im eventually going to want to be calculating the cubes for r=0 to r=1000.... computational time might become an issue.

Last edited by abhor_ennui (2011-01-18 07:59:59)

Offline

Board footer

Powered by FluxBB