Edit and compile if you like:
\documentclass{article} % % File name: intersection-sphere-cone.tex % Description: % A solid bounded by the following surfaces % z = 0 % z = \sqrt{x^{2} + y^{2}} % x^{2} + y^{2} + z^{2} = 1 % is generated. I.e., the intersection of half a sphere and a cone. % % Date of creation: April, 23rd, 2022. % Date of last modification: April, 23rd, 2022. % Author: Efraín Soto Apolinar. % https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/ % Terms of use: % According to TikZ.net % https://creativecommons.org/licenses/by-nc-sa/4.0/ % \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{math} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{1pt} % \begin{document} % \tdplotsetmaincoords{60}{130} \begin{tikzpicture}[tdplot_main_coords,scale=1.75] \tikzmath{function f(\x) {return \x;};} \pgfmathsetmacro{\zini}{0.5*sqrt(2.0)} \pgfmathsetmacro{\step}{0.01} \pgfmathsetmacro{\zsig}{\zini+\step} \pgfmathsetmacro{\nextz}{\zini+0.5*\step} \pgfmathsetmacro{\sig}{2.0*\step} \pgfmathsetmacro{\tini}{0.5*pi} \pgfmathsetmacro{\tfin}{1.85*pi} \pgfmathsetmacro{\tend}{2.5*pi} %%% Coordinate axis \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {\footnotesize$x$}; \draw[dashed,->] (0,0,0) -- (-1.5,0,0); \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {\footnotesize$y$}; \draw[dashed,->] (0,0,0) -- (0,-1.5,0); % The region of integration \draw[gray,thick,fill=yellow,opacity=0.25] plot[domain=0:6.2832,smooth,variable=\t] ({cos(\t r)},{sin(\t r)},{0.0}); % Firts part of the sphere (under the cone) \foreach \altura in {\step,\sig,...,\zini}{ \pgfmathsetmacro{\radio}{sqrt(1.0-\altura*\altura)} \draw[pink,thick,opacity=0.5] plot[domain=\tini:\tfin,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % Now, the cone (the part under the intersection) \foreach \altura in {\step,\sig,...,\zini}{ \pgfmathsetmacro{\radio}{\altura} \draw[cyan,thick,opacity=0.5] plot[domain=\tini:\tfin,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % z axis (first part) \draw[thick] (0,0,0) -- (0,0,1.0); % The cone (level curves: z is constant) \foreach \altura in {\zini,\zsig,...,1.0}{ \pgfmathsetmacro{\radio}{\altura} \draw[cyan,thick,opacity=0.5] plot[domain=\tini:\tfin,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % unit sphere (for z constant) \foreach \altura in {\zini,\nextz,...,1.0}{ \pgfmathsetmacro{\radio}{sqrt(1.0-\altura*\altura)} \draw[pink,thick,opacity=0.5] plot[domain=\tfin:\tend,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + % + + + + Part of the front + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + % The cone (part under the intersection) \foreach \altura in {\step,\sig,...,\zini}{ \pgfmathsetmacro{\radio}{\altura} \draw[cyan,thick,opacity=0.5] plot[domain=\tfin:\tend,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % Unit sphere (for z constant) \foreach \altura in {\zini,\nextz,...,1.0}{ \pgfmathsetmacro{\radio}{sqrt(1.0-\altura*\altura)} \draw[pink,thick,opacity=0.5] plot[domain=\tini:\tfin,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % Part of the sphere under the cone \foreach \altura in {\step,\sig,...,\zini}{ \pgfmathsetmacro{\radio}{sqrt(1.0-\altura*\altura)} \draw[pink,thick,opacity=0.5] plot[domain=\tfin:\tend,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % The cone (for z constant) \foreach \altura in {\zini,\zsig,...,1.0}{ \pgfmathsetmacro{\radio}{\altura} \draw[cyan,thick,opacity=0.5] plot[domain=\tfin:\tend,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } % Finishing of the z axis \draw[thick,->] (0,0,1.0) -- (0,0,1.5) node [above] {\footnotesize$z$}; \end{tikzpicture} \end{document}
Click to download: intersection-sphere-cone.tex • intersection-sphere-cone.pdf
Open in Overleaf: intersection-sphere-cone.tex
See more on the author page of Efraín Soto Apolinar.