该图表示 2 个平面线圈的轴对称表示(圆柱坐标系)。我想给读者增加一些直观感受,向他们展示我们在平面上表示问题,但实际上它是一个“3d”模型。
以下是 MWE:
\documentclass[border=7pt]{standalone}
%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{3d}
%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}[scale=4.5]
\tikzset{zxplane/.style={canvas is zx plane at y=#1,very thin}}
\tikzset{yxplane/.style={canvas is yx plane at z=#1,very thin}}
% Coil 1
\begin{scope}[zxplane=-0.1] % Reflection
\draw[fill=blue!40,opacity=0.8,even odd rule] (0,0) circle (0.1) (0,0) circle (0.42);
\end{scope}
% Coil 2
\begin{scope}[zxplane=0.175] % Secondary
\draw[fill=green!40,opacity=0.8,even odd rule] (0,0) circle (0.228) (0,0) circle (0.428);
\end{scope}
% Plane
\draw [fill=black, opacity=0.2] (0,-0.5) rectangle (0.5, 0.5);
\draw [dashed] (0, -0.5) -- (0, 0.5);
\end{tikzpicture}
\end{document}
目前看起来像这样:
我不知道如何让飞机打破这些环路。任何帮助都将不胜感激。此外,线圈看起来不平衡,如果能把它们弄直就好了。
答案1
欢迎来到 TeX.SE!您已经很接近了。我通过加载引入了 3d 正交坐标tikz-3dplot
,并按以下顺序绘制事物:后面的半线圈、平面,最后是前景中的半线圈。
\documentclass[tikz,border=7pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
%%%%%%%%%%%
\begin{document}
\tdplotsetmaincoords{70}{0}
\begin{tikzpicture}[tdplot_main_coords,scale=4.5,
xyplane/.style={canvas is xy plane at z=#1,very thin}]
% \tikzset{zxplane/.style={canvas is zx plane at y=#1,very thin}}
% \tikzset{yxplane/.style={canvas is yx plane at z=#1,very thin}}
% Coil 1 in the back
\begin{scope}[xyplane=-0.1] % Reflection
\clip(-0.5,0) rectangle (0.5,1);
\draw[fill=blue!40,opacity=0.8,even odd rule] (0,0) circle (0.1) (0,0) circle (0.42);
\end{scope}
% Coil 2 in the back
\begin{scope}[xyplane=0.175] % Secondary
\clip(-0.5,0) rectangle (0.5,1);
\draw[fill=green!40,opacity=0.8,even odd rule] (0,0) circle (0.228) (0,0) circle (0.428);
\end{scope}
% Plane
\begin{scope}[canvas is xz plane at y=0]
\draw [fill=black, opacity=0.2] (0,-0.5) rectangle (0.5, 0.5);
\draw [dashed] (0, -0.5) -- (0, 0.5);
\end{scope}
% Coil 1 in the front
\begin{scope}[xyplane=-0.1] % Reflection
\clip(-0.5,0) rectangle (0.5,-1);
\draw[fill=blue!40,opacity=0.8,even odd rule] (0,0) circle (0.1) (0,0) circle (0.42);
\end{scope}
% Coil 2 in the front
\begin{scope}[xyplane=0.175] % Secondary
\clip(-0.5,0) rectangle (0.5,-1);
\draw[fill=green!40,opacity=0.8,even odd rule] (0,0) circle (0.228) (0,0) circle (0.428);
\end{scope}
\end{tikzpicture}
\end{document}
您可以调整通过 设置的视角\tdplotsetmaincoords{70}{0}
。