아래 그림의 3D 버전을 만들고 싶습니다.
다양한 벡터를 그릴 수 있지만 원통을 표현할 수는 없습니다.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,3D}
\begin{document}
\begin{tikzpicture}[x={(-0.866cm,-0.5cm)}, y={(0.866cm,-0.5cm)}, z={(0,1cm)}]
\draw[-latex] (0,0,0) coordinate(B) -- ++ (3,0,0)node[above]{$x$};
\draw[-latex](B) -- ++ (0,3,0)node[above]{$y$};
\draw[-latex](B) -- ++ (0,0,3)node[right]{$z$};
\foreach \zz in {-20,-15,-10,...,20}{
\pgfmathsetmacro{\ZZ}{\zz/10}
\begin{scope}[canvas is xy plane at z=\ZZ]
\foreach \ii in {-85,-75,...,85}{
\draw[-latex] ({cos(\ii)},{sin(\ii)}) --++ (\ii:{1*cos(\ii)});
}
\end{scope}
}
\end{tikzpicture}
\end{document}
그림은 읽기가 쉽지 않습니다. 개선해야 합니다!
답변1
나는 사용할 것이다tikz-3dplot
것이고reverseclip
장난, 화살표 머리의 길이가 선의 길이에 따라 달라지도록 만듭니다.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc,arrows.meta}
% based on https://tex.stackexchange.com/a/12033/121799
\tikzset{reverseclip/.style={insert path={(current bounding box.south west)rectangle
(current bounding box.north east)} }}
\begin{document}
\tdplotsetmaincoords{60}{135}
\begin{tikzpicture}[tdplot_main_coords]
\draw[-latex] (0,0,0) coordinate(B) -- ++ (3,0,0)node[above]{$x$};
\draw[-latex](B) -- ++ (0,3,0)node[above]{$y$};
\draw[-latex](B) -- ++ (0,0,3)node[right]{$z$};
\draw ({cos(\tdplotmainphi-180)},{sin(\tdplotmainphi-180)},2) --
plot[variable=\t,domain=\tdplotmainphi-180:\tdplotmainphi,smooth,samples=51]
({cos(\t)},{sin(\t)},-2) --
plot[variable=\t,domain=\tdplotmainphi:\tdplotmainphi+360,smooth,samples=101]
({cos(\t)},{sin(\t)},2);
\pgfmathtruncatemacro{\imin}{-\tdplotmainphi+90} % helpers
\pgfmathtruncatemacro{\iminnext}{-\tdplotmainphi+100}
\pgfmathtruncatemacro{\imax}{-\tdplotmainphi+85}
\foreach \zz in {-20,-15,-10,...,20}{
\pgfmathsetmacro{\ZZ}{\zz/10}
\begin{scope}[canvas is xy plane at z=\ZZ]
\foreach \ii in {\imin,\iminnext,...,85}{
\draw[-{Latex[length={cos(\ii)*4pt}]}] ({cos(\ii)},{sin(\ii)}) --++ (\ii:{1*cos(\ii)});
}
\end{scope}
}
% clip away hidden part
\clip ({cos(\tdplotmainphi-180)},{sin(\tdplotmainphi-180)},2) --
plot[variable=\t,domain=\tdplotmainphi-180:\tdplotmainphi,smooth,samples=51]
({cos(\t)},{sin(\t)},-2) --
plot[variable=\t,domain=\tdplotmainphi:\tdplotmainphi+180,smooth,samples=101]
({cos(\t)},{sin(\t)},2) [reverseclip];
\foreach \zz in {-20,-15,-10,...,20}{
\pgfmathsetmacro{\ZZ}{\zz/10}
\begin{scope}[canvas is xy plane at z=\ZZ]
\foreach \ii in {-85,-75,...,\imax}{
\draw[-{Latex[length={cos(\ii)*4pt}]}] ({cos(\ii)},{sin(\ii)}) --++ (\ii:{1*cos(\ii)});
}
\end{scope}
}
\end{tikzpicture}
\end{document}