1
$\begingroup$

I want to draw a semi-transparent ball and highlight its intersection with a plane.

ℛ = ImplicitRegion[x^2 + y^2 + z^2 <= 1 , {x, y, z}];

r3d = 
  RegionPlot3D[ℛ, 
    PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.6, 1.6}}, 
    PlotPoints -> 30]

inter = 
  Region[RegionIntersection[ℛ, InfinitePlane[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]]]

Now why won't this work?

RegionPlot3D[inter, 
  PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.6, 1.6}},  
  PlotPoints -> 30]

I have a implicit region and a plane, I form the intersection, but I'm unable to plot it.

$\endgroup$

2 Answers 2

2
$\begingroup$

On the one hand inter is already a Region and need not be wrapped by RegionPlot3D. RegionPlot3D wants to have a boolean expression as first argument; since an ImplicitRegion essentially consists of such a boolean expression, RegionPlot3D was also overloaded for ImplicitRegions.

On the other hand, is a ImplicitRegion; these are not plotted automatically. But you can turn it into a Region with Region[ℛ] to obtain a preview or apply DiscretizeRegion or DiscretizeBoundaryRegion to compute polyhedral approximations.

As side remark: RegionPlot3D was introduced in version 6.0 while Region was introduced in version 11.1. So RegionPlot3D follows an older mechanic; it was not meant as displaying/plotting function for Regions, even if the name might suggest that.

$\endgroup$
1
$\begingroup$

The why was answered long ago. This covers the mechanical details for visualizing the regions.

Clear["Global`*"];
ℛ = ImplicitRegion[x^2 + y^2 + z^2 <= 1, {x, y, z}];
ℛshell = 
  ImplicitRegion[x^2 + y^2 + z^2 == 1, {x, y, z}];

plane = InfinitePlane[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}];
inter = RegionIntersection[ℛ, plane];
outer = RegionIntersection[
   ℛshell, plane
   ];

To visualize:

Show[
 Region[Style[ℛ, Opacity[0.4, White]]
  , SphericalRegion -> True]
 , Region[Style[inter, Opacity[0.3, Green]]]
 , Region[Style[outer, {Thick, Red}]]
 , Region[Style[plane, Opacity[0.4, Orange]]]
 , Graphics3D[{Point@RandomPoint[DiscretizeRegion@ℛshell, 100]}]
 ]

enter image description here


Addendum

To view the circle inside the sphere with a dashed or hatched pattern, use the following variation:

Show[
 Region[Style[ℛ, Opacity[0.4, White]]
  , SphericalRegion -> True]
 , Region[Style[outer, {Thick, Red}]]
 , Region[Style[plane, Opacity[0.4, Orange]]]
 , Graphics3D[{Point@RandomPoint[DiscretizeRegion@ℛshell, 100]}]
 , RegionPlot3D[DiscretizeRegion@inter
  , Mesh -> 10
  , MeshFunctions -> {#1 &, #2 &}
  , MeshShading -> {{Black, Yellow}, {Pink, Red}}
  ]
 ]

enter image description here

$\endgroup$
3
  • $\begingroup$ Can I view dashed of the circle inside of sphere? $\endgroup$ Commented Jan 2 at 6:46
  • $\begingroup$ I have updated the answer; please take a look. $\endgroup$
    – Syed
    Commented Jan 2 at 7:03
  • $\begingroup$ Thank you very much. $\endgroup$ Commented Jan 2 at 14:26

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.