I found that stacking circles with alternating radii wasn't accurate enough for me, especially for large spheres. That's why I've written a script to generate mathematically perfect spheres.
(Click to enlarge. Credits to IscopeU for building this.)
This was done by using a (larger version of a) blueprint like this one:
If you don't see how it's done right away, there's a description below.
Features
- No redundant voxels. The blueprints presented here have the minimum amount of blocks, you cannot remove any of the voxels without creating a hole in the sphere.
- Cubic symmetry, that is, the spheres are perfectly symmmetric with respect to the cubic nature of Minecraft. They look exactly the same if you look at them from the top, left, front etc.
Blueprints
How to use them
Here's an example of one of the blueprints. For the sake of simplicity I've chosen the one with diameter 3. Don't worry, for bigger spheres the images are clearer.
- Open the blueprint in some graphics program. Even MSPaint should be enough. Zoom in so you can easily see the different pixels.
- Look at the first image, i.e. the one on the very left. Build this pattern on the ground in front of you; one black pixel corresponds to one block in Minecraft. In the end, you've got some roughly circle-shaped object lying flat on the ground to your feet. In the diameter 3 case, that's some kind of a plus-shaped object.
- It's time for the second layer. Your first layer was on the ground level, the second layer is on the level above ground level. Build the second layer "in the air" above your first layer. You've now got a plus, and a donut of blocks above it.
- Build the third layer according to the blueprint ontop of your donut (layer 2).
- Done! That's your diameter 3 sphere. It looks a bit edgy, but that's the limitation of the voxels. The larger the spheres are, the rounder they look.
You may of course start building in the middle. Because of the cubic symmetry of the spheres, you may use the first image as the layer on the right and build from right to left (however I doubt that's very convenient to do).
The blueprints
Here they are, ordered by diameter, 16 per line.
(Red numbers indicate the middle layer(s).)
If the connection times out, it is a temporary error. The server will be running at least until october 2011 (but most probably longer). Anyway, I've packed all images and uploaded them here in case you can't wait.
[001] [002] [003] [004] [005] [006] [007] [008] [009] [010] [011] [012] [013] [014] [015] [016] [017] [018] [019] [020] [021] [022] [023] [024] [025] [026] [027] [028] [029] [030] [031] [032] [033] [034] [035] [036] [037] [038] [039] [040] [041] [042] [043] [044] [045] [046] [047] [048] [049] [050] [051] [052] [053] [054] [055] [056] [057] [058] [059] [060] [061] [062] [063] [064] [065] [066] [067] [068] [069] [070] [071] [072] [073] [074] [075] [076] [077] [078] [079] [080] [081] [082] [083] [084] [085] [086] [087] [088] [089] [090] [091] [092] [093] [094] [095] [096] [097] [098] [099] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122] [123] [124] [125] [126] [127] [128]
[140]
[1024]
About the algorithm
It's basically a really mindless straight forward procedure: Calculate sphere, convert to image. I did pay no attention to effectivity, so especially larger spheres are really messy to calculate. You can view the source code here; because I never intended to post it online it's pretty short on comments though.
A rough outline of the algorithm is as follows:
- Generate a 3D array of size Diameter^3, fill with zeros. Each entry corresponds to one voxel.
- Walk through all entries. If the entry is inside the sphere, set it to 1.
- Optional: If a hollow sphere is desired, walk though all the entries again and set all those to 0 that are not at the boundary.
- Generate image out of the array, and display the z sections next to each other.
("Why did you use PHP? It's not a very effective language." - Well it was effective enough to generate the blueprints in reasonable time. I've got a C++ version as well which is orders of magnitude faster and needs almost no memory, but it lacks the nice image generation, and I don't think anyone actually needs spheres with diameters greater than what I've posted here for real.)
Larger spheres, more complex geometries
There are some other players around who have written programs similar to mine.
- The executable available at http://perfectsphere.codeplex.com/, written by distantcam, allows much larger spheres to be generated.
- An application that converts arbitrary 3D shapes to voxels: http://www.patrickmin.com/minecraft/