是否可以在乳胶中绘制此配置?

是否可以在乳胶中绘制此配置?

我想在 Latex 中绘制这幅图像。

在此处输入图片描述

这里椭圆内的箭头代表偶极子。它们被磁场 $B$ 极化。$d$ 是两个椭圆之间的距离。

答案1

欢迎来到 TeX.SE!此网站的目的是交换代码,并在遇到 LaTeX 问题时寻求帮助。这通常不包括要求其他人将屏幕截图翻译成 LaTeX 代码。但是,对于新手有时会有例外。

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,shapes.geometric,shadows.blur}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
    \def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
    \def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
    \def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
    \tikz@canvas@is@plane}
\makeatother
\begin{document}
\tdplotsetmaincoords{60}{130}
\begin{tikzpicture}[tdplot_main_coords,>=latex,line join=bevel]
    \coordinate (O) at (0,0,0);
    \draw[thick,->] (O) -- (5,0,0) node[anchor=north east]{$x$};
    \draw[thick,->] (O) -- (0,5,0) node[anchor=north west]{$y$};
    \draw[thick,->] (O) -- (0,0,5) node[anchor=south]{$z$};
    \draw[dashed] (O) -- (-5,0,0);
    \begin{scope}[canvas is yz plane at x=5,transform shape]
     \node[ellipse,fill=blue,fill opacity=0.7,draw,minimum width=2cm,minimum height=8mm,
     rotate=65] (elliL) at (2,2) {};
     \path (elliL.west) -- (elliL.east) coordinate[pos=0.1] (L1b)
     coordinate[pos=0.3] (L1t) coordinate[pos=0.4] (L2b)
     coordinate[pos=0.6] (L2t) coordinate[pos=0.7] (L3b)
     coordinate[pos=0.9] (L3t);
     \foreach \X in {1,2,3}
     {\draw[thick,-latex] (L\X b) -- (L\X t);}
    \end{scope}
    \begin{scope}[canvas is yz plane at x=-1,transform shape]
     \node[ellipse,fill=blue,fill opacity=0.7,draw,minimum width=2cm,minimum height=8mm,
     rotate=80] (elliR) at (2,2) {};
     \path (elliR.west) -- (elliR.east) coordinate[pos=0.1] (R1b)
     coordinate[pos=0.3] (R1t) coordinate[pos=0.4] (R2b)
     coordinate[pos=0.6] (R2t) coordinate[pos=0.7] (R3b)
     coordinate[pos=0.9] (R3t);
     \foreach \X in {1,2,3}
     {\draw[thick,-latex] (R\X b) -- (R\X t);}
    \end{scope}
    % this is essentially from the tikz-3dplot manual p. 26-27
    \pgfmathsetmacro{\rvec}{7}
    \pgfmathsetmacro{\thetavec}{30}
    \pgfmathsetmacro{\phivec}{60}
    \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
    \node[anchor=south west,color=red] at (P) {$B$};
    \draw[-stealth,color=red,very thick] (O) -- (P);
    \draw[dashed, color=red] (O) -- (Pxy);
    \draw[dashed, color=red] (P) -- (Pxy);
    \tdplotdrawarc{(O)}{1}{0}{\phivec}{anchor=north}{$\phi$}
    \tdplotsetthetaplanecoords{\phivec}
    \tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{1.5}{0}%
        {\thetavec}{anchor=-110}{$\theta$}
    %
    \begin{scope}[canvas is xy plane at z=0,blue!70]
    \path (5,2) -- (-1,2) node[midway,below] {$d$}; 
    \pgflowlevelsynccm% not necessary but maybe nicer
    \draw[ultra thick,latex-latex] (5,2) -- (-1,2);
    \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

我个人并不想依赖别人,玩这些代码会很有趣。因此,我鼓励你尝试弄清楚这里发生了什么。

相关内容