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 cross-sectional layer? (think of an MRI scan cross-section)
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=√[(x2-x1)2+(y2-y1)2+(z2-z1)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
re: Excel implementation of Specific Algorithm by Dustin)
Dustin,
in response to your question about a Javascript emulation for a Hollow Sphere please select the link. (The change to my script was really just a small one line inclusion).
This particular offer would mean that some blocks would have to be joined by edges, see Rad=3 and layers 1 and 0. (Dustin and I have discussed this).
This is the same except that the this is solid.
Note: if future readers find these links broken then it is because those scripts, currently located on a server exterior to Perplexus, will have been removed.
Edited on February 26, 2012, 6:45 pm
|
Posted by brianjn
on 2012-02-26 18:41:57 |