I would like to construct a sphere by gluing unit cubes together. I'm only attempting to approximate the shape of a sphere as closely as is possible with unit cubes.
Before I get out the glue, how would I go about creating a spreadsheet that would show me the quantity and placement of cubes in each crosssectional layer? (think of an MRI scan crosssection)
For input, the spreadsheet should ask for the radius of the sphere to be built, as well as which layer of that sphere should be displayed.
There may be more than one way to accomplish this. Any spreadsheet that will allow me to build a sphere by displaying each layer of a sphere for a given radius is considered valid.
Here is an example of output:
Hint: The formula for distance in 3 dimensions is:
d=√[(x_{2}x_{1})^{2}+(y_{2}y_{1})^{2}+(z_{2}z_{1})^{2}]
Bonus question! Adjust your algorithm to display a hollow sphere (think of a ping pong ball, or a beach ball). Note: All cubes must be connected into one contiguous piece.
(In reply to
Excel implementation of Specific Algorithm by Steve Herman)
Looks great!
In mine, the center is always the same cell, regardless of the radius, but as the problem states, your solution is quite valid, as it produces the required result. In fact, your method is preferable in some ways to mine. If I want to allow for larger radii, I must add numbers to left and right, and top and bottom. In your method, you only have to extend right and down.
I think you have a small typo in your post, though: "Cell B1: 9" should be "Cell B2: 9".
Do you have any ideas about the bonus question? :)
brianjn, if you have a working javascript spreadsheet for a hollow sphere, I'd be interested to see it here. I still might refrain from posting a complete explanation of your algorithm for perhaps a day, so Steve has a chance to work on it.

Posted by Dustin
on 20120226 16:45:46 