我正在尝试在 TikZ 中重新创建以下插图。
在 hpekristiansen 的帮助下,我现在所做的是:
\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\usepackage[siunitx]{circuitikz}
\begin{document}
\tdplotsetmaincoords{70}{50}
\begin{tikzpicture}[tdplot_main_coords]
% untere horizontale Platte
\draw[thick] (0,0,-0.4) -- +(0,0,-1); % Anschluss untere Platte
\filldraw[fill=green, canvas is xy plane at z=-0.4] (-1,-1) rectangle +(2,2);
% hintere vertikale Platte
\draw[thick] (5,.4,0) -- +(0,2,0); % Anschluss hintere Platte
\filldraw[fill=magenta, canvas is xz plane at y=0.4] (4,-1) rectangle +(2,2);
\draw[very thick, dotted, ] (-4,0,0) -- (4,0,0) to[bend left] (10,-1,-1); % Elektronenstrahl
% Strahlerzeugungssystem
\draw[thick] (-4.5,-3, 0) to [L] (-4.5,3, 0); %Kathode
\draw[thick] (-4.5,-.9,0) -- +(-1.5,0,0) to [battery1, l=$U_H$] (-6,.9,0) -- (-4.5, .9,0);
\draw[white, very thick] (-4.5, .9,0) -- (-4.5,3, 0);
\filldraw[gray!50, canvas is yz plane at x=-2.5, even odd rule] (0,0) circle (1cm) circle (.25cm); %Lochanode
\draw[thick] (-2.5,{cos(270)},{sin(270)}) -- +(0,0,-.5) to [battery1, l=\small $U_B$] (-4.5,-3, 0);
\filldraw[fill=green, canvas is xy plane at z=0.4] (-1,-1) rectangle +(2,2); %untere Platte
\draw[thick] (0,0,0.4) -- +(0,0,1) node [above] {$U_v$}; % Anschluss obere Platte
\filldraw[fill=magenta, canvas is xz plane at y=-0.4] (4,-1) rectangle +(2,2); %vordere Platte
\draw[thick] (5,-.4,0) -- +(0,-2,0) node [at end, xshift=-.25cm] {$U_h$}; % Anschluss vordere Platte
% Leuchtschirm
\draw[canvas is yz plane at x=10] (-2,-2) grid (2,2);
\filldraw[black] (10,-1,-1) circle (3pt) node [right, xshift=.33cm] {1};
\filldraw[red] (10,-1,-2) circle (3pt) node [right, xshift=.33cm] {2};
%Röhre
\coordinate (p1) at (10,{3.25*cos(75)},{3.25*sin(75)});
\coordinate (p2) at (10,{3.25*cos(225)},{3.25*sin(225)});
\draw[very thick] (-5,5,0) -- +(5,0, 0) -- (p1);
\draw[very thick] (-5,-5,0) -- +(10,0, 0) -- (p2);
\draw[very thick] (-5,5,0) to [bend right=40] (-5,-5,0);
% kreisförmiger Leuchtring
\draw[very thick, dashed, canvas is yz plane at x=10, domain=75:225] plot ({3.25*cos(\x)}, {3.25*sin(\x)});
\draw[very thick, canvas is yz plane at x=10, domain=225:435] plot ({3.25*cos(\x)}, {3.25*sin(\x)});
\end{tikzpicture}
\end{document}
现在开放的有:
- 管子的左侧是圆的,但不均匀。我想用平滑的曲线连接两个角点
- 管子与圆圈的下部连接看起来不是特别漂亮。这是我能做的最好的了。也许有人有主意 :)
答案1
这里有您需要的大部分 3D 部件。完成其余部分,如果遇到困难,请向 MWE 咨询。
\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\begin{document}
\tdplotsetmaincoords{70}{50}
\begin{tikzpicture}[tdplot_main_coords]
\filldraw[fill=green, canvas is xy plane at z=-0.4] (-1,-1) rectangle +(2,2);
\filldraw[fill=magenta, canvas is xz plane at y=0.4] (4,-1) rectangle +(2,2);
\draw[very thick, dashed] (-4,0,0) -- (4,0,0) to[bend left] (10,-1,-1);
\filldraw[fill=green, canvas is xy plane at z=0.4] (-1,-1) rectangle +(2,2);
\filldraw[fill=magenta, canvas is xz plane at y=-0.4] (4,-1) rectangle +(2,2);
\draw[canvas is yz plane at x=10] (-2,-2) grid (2,2);
\end{tikzpicture}
\end{document}
编辑: 我添加了一些宏来帮助设计,但由于其他一切都是硬编码,当粗略设计确定后,我会再次删除这些宏,然后进行微调。按照这里显示的设计,电源需要移得更远一些。也许整个管子需要稍微灰白一点的颜色?plot
制作许多小线段(或带有的曲线smooth
),所以我把它改成了arc
/ circle
。
\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\usepackage[siunitx]{circuitikz}
\begin{document}
\tdplotsetmaincoords{70}{50}
\begin{tikzpicture}[tdplot_main_coords]
\draw[thick] (0,0,-0.4) -- +(0,0,-1);
\filldraw[fill=green, canvas is xy plane at z=-0.4] (-1,-1) rectangle +(2,2);
\draw[thick] (5,.4,0) -- +(0,2,0);
\filldraw[fill=magenta, canvas is xz plane at y=0.4] (4,-1) rectangle +(2,2);
\draw[very thick, dotted, ] (-4,0,0) -- (4,0,0) to[bend left] (10,-1,-1);
\draw[thick] (-4.5,-3, 0) to [L] (-4.5,3, 0);
\draw[thick] (-4.5,-.9,0) -- +(-1.5,0,0) to [battery1, l=$U_H$] (-6,.9,0) -- (-4.5, .9,0);
\draw[white, very thick] (-4.5, .9,0) -- (-4.5,3, 0);
\filldraw[gray!50, canvas is yz plane at x=-2.5, even odd rule] (0,0) circle (1cm) circle (.25cm);
\draw[thick] (-2.5,{cos(270)},{sin(270)}) -- +(0,0,-.5) to [battery1, l=\small $U_B$] (-4.5,-3, 0);
\filldraw[fill=green, canvas is xy plane at z=0.4] (-1,-1) rectangle +(2,2);
\draw[thick] (0,0,0.4) -- +(0,0,1) node [above] {$U_v$};
\filldraw[fill=magenta, canvas is xz plane at y=-0.4] (4,-1) rectangle +(2,2);
\draw[thick] (5,-.4,0) -- +(0,-2,0) node [at end, xshift=-.25cm] {$U_h$};
\draw[canvas is yz plane at x=10] (-2,-2) grid (2,2);
\filldraw[black] (10,-1,-1) circle (3pt) node [right, xshift=.33cm] {1};
\filldraw[red] (10,-1,-2) circle (3pt) node [right, xshift=.33cm] {2};
%added/changed:
\pgfmathsetmacro{\angfl}{245}
\pgfmathsetmacro{\angfr}{65}
\pgfmathsetmacro{\rf}{1}
\coordinate (p1) at (-5,{\rf*cos(\angfl)},{\rf*sin(\angfl)});
\coordinate (p2) at (-5,{\rf*cos(\angfr)},{\rf*sin(\angfr)});
\draw[very thick, canvas is yz plane at x=-5] (p1) arc [radius=1, start angle=\angfl, end angle=\angfr];
\draw[very thick, dashed, canvas is yz plane at x=-5] (p1) arc [radius=1, start angle=\angfl, end angle=\angfr-360];
\pgfmathsetmacro{\angsl}{230}
\pgfmathsetmacro{\angsr}{70}
\pgfmathsetmacro{\rs}{3.25}
\coordinate (p3) at (10,{\rs*cos(\angsl)},{\rs*sin(\angsl)});
\coordinate (p4) at (10,{\rs*cos(\angsr)},{\rs*sin(\angsr)});
\draw[very thick, canvas is yz plane at x=10] (0,0) circle[radius=3.25];
\draw[very thick] (p1) to[out=\angfl+90, in=\angsl-90] (p3);
\draw[very thick] (p2) to[out=\angfr-90, in=\angsr+90] (p4);
\end{tikzpicture}
\end{document}