Recently I have seen a code in mathematica about Slicing through Graphics3D in Slice through Graphics3D. My questions is: Is it possible to fill out these spheres? I have problem with generating randomly distributed filled spheres inside cube. Bakha
Asked
Active
Viewed 617 times
3
1 Answers
6
With V10 you can use ClipPlanes
Graphics3D[{Red, Opacity[0.5], Cuboid[]},
Axes -> True,
ClipPlanes -> {{1, 1, -1, 0}},
ClipPlanesStyle -> {Directive[Opacity[0.2], Green]}]

Show[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}],
ClipPlanes -> {{-1, 1, 0, 1}},
ClipPlanesStyle -> {Directive[Opacity[.3], Brown]}]

Something like this?
z = 100;
p = RandomReal[100, {z, 3}];
r = RandomReal[10, {z}];
spheres = GraphicsComplex[p, Sphere[Range[z], r]];
Grid[
Partition[
Map[
Graphics3D[{Red, spheres},
Axes -> True,
ClipPlanes -> {{0, 1, 0, #}},
ClipPlanesStyle -> {Directive[Opacity[0.2], Green]}] &,
Range[-1, -100, -10]],
5],
Dividers -> All]

eldo
- 67,911
- 5
- 60
- 168
-
In my project I have to generate 3D model of randomly distributed filled spheres inside cube. As a result I have to show the distribution of the spheres in the cube layer by layer. Using the mentioned before Slice through Graphics3D problem I have a 3D model but when I am going to see it layer by layer I am seeing just square with empty region inside. Is it possible to fill it out? – bakha Sep 29 '14 at 09:49
gr = Graphics3D[{FaceForm[Yellow, Black], obj}, Axes -> True]kind of gives this effect since you can't perceive depth with black inside. – C. E. Sep 29 '14 at 08:58