# Calculate “Volume” and “Surface Area” of a voxel-based sphere

By "voxel-based sphere" I mean a sphere made up of cubes. Sorry if that is not the correct terminology. Imagine a sphere made out of legos. Except each voxel is a cube (unlike most legos). Determining the voxel distribution to make the sphere I suppose would involve calculating the x/y/z of a position on the sphere and then 'snapping' it to the nearest multiple of the voxel width/height.

Here's a calculator that can generate one: http://neil.fraser.name/news/2006/11/17/

And here is an image of one (cross sectioned):

Given the diameter of this voxel sphere (in number of voxels, e.g. '20 voxels in diameter'), how can I calculate:

1. The number of voxels in the sphere if it were hollow (kind of a 'surface area')
2. The number of voxels in the sphere if it were solid (kind of a 'volume')

Is there a formula possible here? :)

-
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions. – anon Nov 10 '11 at 3:03