Skip to main content
4 of 4
added 474 characters in body

Discretize a Graphics3D object over a given 3D lattice

Is there a way to discretize a Graphics3D object using a regular lattice with a given lattice spacing. For example:

Graphics3D[Sphere[3], PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}]

or in the case of multiple spheres:

ClearAll["Global`*"]
array1 = {1, 5, -2};
array2 = {2, 6, -1};
array3 = {3, 3, 2};
array4 = {1, 3, 2};
ONE = MapThread[
Ball[{#1, #2, #3}, #4] &, {array1, array2, array3, array4}];
Graphics3D[{Red, ONE}, ImageSize -> 400, ImageSize -> 600, 
PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}, ImageSize -> 400, 
Axes -> True, 
LabelStyle -> {FontFamily -> "Arial", FontSize -> 20}];

I'd like 1s for lattice points lying in the sphere region and 0s for everything outside. For a lattice spacing of 1, I would expect 111111 points.