# How to draw intersection of a plane and a sphere?

I am trying draw a circle is intersection of a plane has equation 2 x − 2 y + z − 15 = 0  and the equation of the sphere is ( x − 1)^2 + ( y + 1)^ 2 + ( z − 2)^ 2 − 25 = 0. With the plane, I tried

Clear[f]
f[x_, y_] := 15 - 2 x + 2 y;
Graphics3D[ {Red,
Polygon[Flatten[#, 1] &@{#[[1]], #[[2]],
f[#[[1]], #[[2]]]} & /@ {{-10, -10}, {-10, 10}, {10,
10}, {10, -10}}]}, Boxed -> False]


and the sphere, I tried

Graphics3D[{Opacity[0.5], Sphere[{1, -1, 2}, 5]}]


Sphere and plane, I tried

Clear[f]
f[x_, y_] := 15 - 2 x + 2 y;
Graphics3D[{Opacity[0.5], Cyan, Sphere[{1, -1, 2}, 5]}, {Red,
Polygon[Flatten[#, 1] &@{#[[1]], #[[2]],
f[#[[1]], #[[2]]]} & /@ {{-10, -10}, {-10, 10}, {10,
10}, {10, -10}}]}, Boxed -> False]


I only get

How can I get the correct result?

• One way is to use InfinitePlane for the plane and Sphere for the sphere. Visualize (draw) them with Graphics3D. Then use RegionIntersection on the plane and the sphere, not on the graphical visualization of the plane and the sphere, to get the circle. Draw the intersection with Region and Style. Use Show to combine the visualizations. Commented Jul 18, 2021 at 2:52
• It is important to note that your syntax is incorrect in your sphere and plane attempt, hence the red highlighting of the output. Commented Jul 18, 2021 at 5:55
• @LouisB Thank you for your comment. Commented Jul 18, 2021 at 6:49
• @LouisB I tried like this. It seems incorrect at reg = RegionIntersection[sph, hp]; . How can I repair? R = 4; h = R - 5; v1 = {0, 0, h}; n1 = {0, 0, 1}; sph = Sphere[{0, 0, 0}, R]; hp = Hyperplane[n1, v1]; reg = RegionIntersection[sph, hp]; Graphics3D[{{Opacity[.5], sph}, {Opacity[.5], hp}}, Boxed -> False] Commented Aug 2, 2021 at 2:40
• It's a little tricky because we draw the sphere and plane with Graphics3D, but we draw the intersection with Region and Style. Then we use Show to combine two. This should give it to you: Show[Region[Style[reg, Thick, Black]], Graphics3D[{{Blue, Opacity[.2], sph}, {Orange, Opacity[.5], hp}}]] Commented Aug 2, 2021 at 3:03

f[x_, y_] := 15 - 2 x + 2 y;
reg1 = Polygon[
Flatten[#, 1] &@{#[[1]], #[[2]],
f[#[[1]], #[[2]]]} & /@ {{-10, -10}, {-10, 10}, {10,
10}, {10, -10}}];
reg2 = Sphere[{1, -1, 2}, 5];
int = DiscretizeRegion@RegionIntersection[reg1, reg2];
Graphics3D[{{Opacity[0.5], Cyan, reg2}, {Red, reg1}, {Yellow,
Thickness[.02], int}}, Boxed -> False]


Another ways is use ContourPlot3D.

f[x_, y_] = 15 - 2 x + 2 y;
g[x_, y_] = (x \[Minus] 1)^2 + (y + 1)^2 + (z \[Minus] 2)^2 \[Minus]
25;
c = 6;
ContourPlot3D[{g[x, y] == 0, f[x, y] == 0}, {x, 1 - c,
1 + c}, {y, -1 - c, -1 + c}, {z, 2 - c, 2 + c},
MeshFunctions -> Function[{x, y, z}, f[x, y]], Mesh -> {{0}},
PlotPoints -> 80, MeshStyle -> {Thickness[.01], Yellow},
ContourStyle -> {{Opacity[0.5], Cyan}, Red}, Boxed -> False,
Axes -> False, BoundaryStyle -> None]