I should be able to get this from the answer here - but, with apologies, I'm afraid I can't figure it out.
I have a sphere and a plane as follows:
x = InfiniteLine[{{0, 0, 0}, {1, 0, 0}}];
y = InfiniteLine[{{0, 0, 0}, {0, 1, 0}}];
z = InfiniteLine[{{0, 0, 0}, {0, 0, 1}}];
plane = InfinitePlane[{{1/2, 0, 0}, {1/2, 1, 0}, {1/2, 0, 1}}];
sphere = Sphere[{5, 0, 0}, 10];
sphereOrigin = Point[{5, 0, 0}];
Graphics3D[{{Thick, x}, {Thick, y}, {Thick, z}, {Opacity[0.15],
plane}, {Opacity[0.15], sphere},
{PointSize[Large], Red, sphereOrigin}}, Boxed -> False]
What I want is a circle marking the contour where the sphere intersects the plane. I don't want to manually add it, because I may wish to use different spheres and different planes.
My trouble is that, when I try to use ContourPlot3D
, my math gets muddled; whereas if I try to use Graphics3D
I can't figure out how to generate the contour line.
I realise that this is a more basic example of a question that's already been answered - but that just means that the more sophisticated answer is too complex for me...
intersection = DiscretizeRegion[RegionIntersection[sphere, plane]];
then just putintersection
in your graphics. It is unfortunate that we are forced to discretize it, that the resulting region is a generalBooleanRegion
, and that Mathematica doesn't have a 3D ellipse/circle primitive which it can replace it with. $\endgroup$