# How to remove the cap of a sphere in and chose the side where it cuts

How can I remove the cap of a sphere in graphics ?

Graphics3D[{Red, Sphere[{0, 0, 0}, 5]}, Axes -> True, PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}]


I'd like to remove the green part for example here :

EDIT : After having an answer, I still have a problem when I want to chose the side it must cut. For instance

Graphics3D[{Sphere[]},
ClipPlanes -> InfinitePlane[{{0, 1, 0.8}, {2, 0, 0.8}, {0, 0, 0.8}}]]


cuts the top. But what if I want to cut the bottom. So I know I could cut at $$-0.8$$ and return. But if I want to cut the two caps at the top and the bottom how could I proceed ?

• See the first example for ClipPlanes. May 28, 2020 at 15:58
• Have you read through the documentation for ClipPlanes as suggested by @JasonB.? The "Neat Examples" section demonstrates how to cut multiple planes – you just have to specify a list of planes to cut. May 28, 2020 at 19:14
• You can change the orientation of the plane by permuting points. e.g. Graphics3D[{Sphere[]}, ClipPlanes -> InfinitePlane[{{2, 0, 0.8}, {0, 1, 0.8}, {0, 0, 0.8}}]] May 28, 2020 at 21:42

You can specify ClipPlanes as a 4-tuple (or as a list of 4-tuples) to control the directions more conveniently. It is also more convenient to use ClipPlanes as a directive (rather than an option) to specify multiple clip planes for a given primitive:

ClipPlanes >> Details

Graphics3D[{ClipPlanes -> {{0, 0, -1, .8}, {0, 0, 1, .7}, {1, 1, 1, 1.5}},
Opacity[.7], Sphere[]},
Axes -> True, Ticks -> {Automatic, Automatic, {-.7, .8 }}]


ClipPlanesStyle -> (Opacity[.5, #] & /@ {Red, Blue, Green})


to see the three clipping planes:

Update: A function to flip the side that is cut away by a clip plane:

ClearAll[flipSide]
flipSide[{a_?NumericQ, b_, c_, d_}] := -{a, b, c, d};
flipSide[ip_InfinitePlane] := MapAt[#[[{2, 1, 3}]] &, ip, {1}];

Graphics3D[{{Red, ClipPlanes -> {{1, 0, 1, -.8}}, Opacity[.7],
Sphere[]}, {Green, ClipPlanes -> {flipSide@{1, 0, 1, -.8}},
Opacity[.7], Sphere[]}}, Axes -> True, ImageSize -> Medium]


Graphics3D[{{Red, ClipPlanes -> {InfinitePlane[{{0, 0, 0}, {0, 1, 1}, {1, 1, 2}}]},
Opacity[.7], Sphere[]},
{Green, ClipPlanes -> {flipSide@
InfinitePlane[{{0, 0, 0}, {0, 1, 1}, {1, 1, 2}}]}, Opacity[.7],
Sphere[]}}, Axes -> True, ImageSize -> Medium]