1

I have variable with figures

a = {Red, Cuboid[{2, 2, 2}, {5, 5, 5}], Green, Ellipsoid[{8, 8, 8}, {2, 2, 2}]};

And I show it in Manipulate with dynamic ClipPlanes

Manipulate[
 Show[{
   Graphics3D[{a}, PlotRange -> {{0, 10}, {0, 10}, {0, 10}},
    Boxed -> True, ImageSize -> {300, 300}, 
    ClipPlanes -> {i, j, 1, -k + 0.01}, 
    ClipPlanesStyle -> {Directive[Opacity[.3], Blue]}]}],
 "Plane",
 {{i, 0, "X"}, 0, 2, .01, ImageSize -> Small, Appearance -> "Labeled"},
 {{j, 0, "Y"}, 0, 2, .01, ImageSize -> Small, Appearance -> "Labeled"},
 {{k, 0, "Z"}, 0, 20, .01, ImageSize -> Small, 
  Appearance -> "Labeled"},
 ControlPlacement -> Left]

How can I show places, when ClipPlanes intersect with the figures?

Something like this: Example

kglr
  • 394,356
  • 18
  • 477
  • 896
Andrew
  • 35
  • 4

1 Answers1

1

here is a workaround :

Define 2 cuboids, one inside the other, lightly smaller, and paint the faces that are in the space between in black :

thickness=0.2

a = {
FaceForm[Red,Black], Cuboid[{2, 2, 2}, {5, 5, 5}],
FaceForm[Black,Red],Cuboid[{2, 2, 2} + thickness,  {5, 5, 5} - thickness],
Green, Ellipsoid[{8, 8, 8}, {2, 2, 2}]}

Show[{Graphics3D[{a},
PlotRange->{{0,10},{0,10},{0,10}},Boxed->True,ImageSize->{300,300},
ClipPlanes->{0,0,1,-3.19+0.01`},
ClipPlanesStyle->{Directive[Opacity[0.3`],Blue]}]},
ViewCenter->{0.5`,0.5`,0.5`}, 
ViewPoint->{0.72,-2.26,-2.40},
ViewVertical->{0.20,-0.96,0.14}]  

enter image description here

andre314
  • 18,474
  • 1
  • 36
  • 69
  • I have tried to use some Region... but it doesn't works because of this – andre314 Apr 15 '18 at 18:05
  • I have not tested this beyond your example. There are surely some problems with more complex geometries, for instance if the ellipsoid intersects the cuboid... – andre314 Apr 15 '18 at 18:11
  • Maybe you know, how can I do color picker in the Manipulate instead of black color? – Andrew Apr 17 '18 at 17:54
  • @Andrew Manipulate[col,{{col,Black},ColorSetter}] or Manipulate[col,{{col,Black},ColorSlider}] – andre314 Apr 17 '18 at 18:19
  • Yes, this code create color picker, but how can I use this color instead of black color in your example? – Andrew Apr 18 '18 at 09:24