3
$\begingroup$

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

$\endgroup$
5
  • 1
    $\begingroup$ gr = Graphics3D[{FaceForm[Yellow, Black], obj}, Axes -> True] kind of gives this effect since you can't perceive depth with black inside. $\endgroup$
    – C. E.
    Commented Sep 29, 2014 at 8:58
  • $\begingroup$ 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 $\endgroup$
    – bakha
    Commented Sep 29, 2014 at 9:39
  • $\begingroup$ 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. $\endgroup$
    – C. E.
    Commented Sep 29, 2014 at 10:10
  • $\begingroup$ 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. $\endgroup$
    – Bakha
    Commented Sep 29, 2014 at 23:21
  • $\begingroup$ Dear @Bakha you have two profiles registered, it seems: here and here. Please follow the instructions at: stackoverflow.com/help/merging-accounts so your total reputation counts. $\endgroup$
    – Verbeia
    Commented Sep 30, 2014 at 1:23

1 Answer 1

6
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ 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? $\endgroup$
    – bakha
    Commented Sep 29, 2014 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.