Intersection of Cylinder and Plane

intersection-cylinder-plane

Edit and compile if you like:

\documentclass{article}
%
% Nombre de archivo: intersection-cylinder-plane.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 a cylinder and a plane.
% 
% 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}
\usetikzlibrary{patterns}
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1pt}
%
\begin{document}
	%
	\tdplotsetmaincoords{60}{110}
	\begin{tikzpicture}[tdplot_main_coords,scale=0.75]
		\pgfmathsetmacro{\final}{2.0*pi}
		% The equation of the circumference
		\draw[white] (0,-2.5,0) -- (2.75,0,0) node[blue,midway,below,sloped] {\footnotesize$x^2 + y^2 = 4$};
		% Region of integration: circle of radius 2
		\draw[thick,fill=yellow,opacity=0.5] plot[domain=0:6.2832,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{0.0});
		%%% Coordinate axis
		\draw[thick,->] (0,0,0) -- (3.5,0,0) node [below left] {\footnotesize$x$};
		\draw[dashed] (0,0,0) -- (-3,0,0);
		\draw[thick,->] (0,0,0) -- (0,3.5,0) node [right] {\footnotesize$y$};
		\draw[dashed] (0,0,0) -- (0,-3,0);
		\draw[thick] (0,0,0) -- (0,0,4);% node [above] {\footnotesize$z$};	
		% The plane: x + y = 2
		\coordinate (A) at (3,2.5,1.5);
		\coordinate (B) at (-3,2.5,1.5);
		\coordinate (C) at (-3,-2.5,6.5);
		\coordinate (D) at (3,-2.5,6.5);
		% The Cylinder
		\foreach \angulo in {0,0.01,...,\final}{
			\pgfmathparse{2.0*cos(\angulo r)}
			\pgfmathsetmacro{\px}{\pgfmathresult}
			\pgfmathparse{2.0*sin(\angulo r)}
			\pgfmathsetmacro{\py}{\pgfmathresult}
			\draw[cyan,opacity=0.5] (\px,\py,0) -- (\px,\py,4.0-\py);
		}
		% Trace (intersection of the plane and the cylinder)
		\draw[blue,thick] plot[domain=0:6.2832,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{4.0-2.0*sin(\t r)});
		% Circumferences bounding the cylinder
		\draw[blue,thick,opacity=0.5] plot[domain=0:6.2831853,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{4.0-2*sin(\t r)}); 
		\draw[blue,thick,opacity=0.5] plot[domain=0:6.2831853,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{0.0}); 
		% The plane
		\draw[white] (C) -- (B) node[red,above,sloped,midway]{\footnotesize$y + z = 4$};
		\draw[red,dash dot] (A) -- (B) -- (C)	 -- (D) -- (A);
		\fill[pattern color=pink,pattern=north east lines] (A) -- (B) -- (C)	 -- (D) -- (A);
		\fill[yellow,opacity=0.35] plot[domain=0:6.2832,smooth,variable=\t] ({2.0*cos(\t r)},{2.0*sin(\t r)},{4.0-2.0*sin(\t r)});
		% Tz axis (last part)
		\draw[thick,->] (0,0,4) -- (0,0,8) node [above] {\footnotesize$z$};	
	\end{tikzpicture}
\end{document}

Click to download: intersection-cylinder-plane.texintersection-cylinder-plane.pdf
Open in Overleaf:
intersection-cylinder-plane.tex
See more on the author page of Efraín Soto Apolinar.

Leave a Reply

Your email address will not be published.