All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Constructing a Sphere (Posted on 2012-02-25) Difficulty: 3 of 5
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:


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.

No Solution Yet Submitted by Dustin    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): coming from behind Comment 16 of 16 |
(In reply to re: coming from behind by broll)

Thanks broll, but what was neat?

 The "artwork" of the spreadsheet display?  That was painful to format it as well as that!!  Even with advices I still didn't understand Dustin's Hint formula, or rather how to incorporate it into a spreadsheet.

Let's take that "spreadsheet" a little further.
When Dustin first mooted a programming idea I had some reservations.  He offered me a spreadsheet, and even then my fears were not dispelled as his offer had coloured blocks, much as my javascript renditions!  Frankly I still haven't worked out exactly how he accomplished that even though he gave me some advices.

That said, I have been able to edit his algorithm so that it complies with the basic format of "1" (or "X" in Steve Herman's case).

Paste this formula into X22 of the sheet of coming from behind and then copy it across the display area:

I can't claim credit for that (I deleted references to other sheets in his workbook).  I indicated very early in discussions that I had some prior knowledge of the problem, had little to no input from Dustin other than 'bounce' ideas as I recall, but I felt some need for temporary disqualification to "disclose my hand".  Hence 'coming from behind'. 

  Posted by brianjn on 2012-03-02 22:28:41

Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information