1
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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

$\endgroup$
  • $\begingroup$ I have tried to use some Region... but it doesn't works because of this $\endgroup$ – andre314 Apr 15 '18 at 18:05
  • $\begingroup$ 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... $\endgroup$ – andre314 Apr 15 '18 at 18:11
  • $\begingroup$ Maybe you know, how can I do color picker in the Manipulate instead of black color? $\endgroup$ – Andrew Apr 17 '18 at 17:54
  • $\begingroup$ @Andrew Manipulate[col,{{col,Black},ColorSetter}] or Manipulate[col,{{col,Black},ColorSlider}] $\endgroup$ – andre314 Apr 17 '18 at 18:19
  • $\begingroup$ Yes, this code create color picker, but how can I use this color instead of black color in your example? $\endgroup$ – Andrew Apr 18 '18 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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