3

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

bakha
  • 31
  • 1
  • 1
    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
  • 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:39
  • I understand your question and I maintain that my suggestion kind of gives the expected result. It's not the real deal, hence I posted it as a comment. – C. E. Sep 29 '14 at 10:10
  • Is it possible to see it layer by layer separately? I mean to see first layer in first graph, second in second graph, etc., without adding one layer to others. – Bakha Sep 29 '14 at 23:21
  • Dear @Bakha you have two profiles registered, it seems: here and here. Please follow the instructions at: http://stackoverflow.com/help/merging-accounts so your total reputation counts. – Verbeia Sep 30 '14 at 01:23

1 Answers1

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]}]

enter image description here

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

enter image description here

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]

enter image description here

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