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
More specific algorithm (spoiler) by Steve Herman)
Steve,
I have taken great interest in your forethought and proposal.
There are elements which I have utilised to create a javascript simulation of Dustin's solid layering. It works perfectly (other than a 'bug' to my personal annoyance  can fix but haven't). Oh! For future readers, please do not be surprised if the link fails as it references an offline location.
That said, and also having been privy to Dustin's thoughts regarding his "shelled" layers, I did manage a spreadsheet solution that equates to the javascript. It would have been grossly improper of me to post my solution upon publication, and I think I should still restrain.
I think Dustin would like something more specific so that he could take your advice directly into his open spreadsheet book and emulate something equivalent to his thoughts.
I accept if countermanded by Dustin.

Posted by brianjn
on 20120226 08:43:28 