在弯曲线和半椭圆线的中间画出

在弯曲线和半椭圆线的中间画出

我正在尝试绘制磁场图,但不确定如何在弯曲和椭圆线中间画箭头(黄色突出显示所需的输出)。

有人可以建议如何实现这一点吗?

谢谢你!

电流输出

\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{pgfplots}
\usepackage{amsmath}
\newtheorem{theorem}{THEOREM}
\newtheorem{proof}{PROOF}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\usepackage{fancyhdr}
\usepackage{bigints}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{color,xcolor}
\usepackage{booktabs,array}
\usepackage{hyperref}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{polynom}
\usepackage{wallpaper}
\usepackage{flexisym}
\usepackage{caption}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows.meta,decorations.markings}
\usetikzlibrary{arrows}
\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{statistics}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}

\begin{tikzpicture}
%MAGNET
\fill[gray!60](0,-0.5) rectangle (2.5,0.5);
\fill[gray!60](5.5,-0.5) rectangle (8.0,0.5);
%
\node at (2.2,0) {\Large N};
\node at (5.8,0) {\Large S};
%
\draw[gray,thick](0,-0.5) -- (2.5,-0.5) -- (2.5,0.5) -- (0,0.5);
\draw[gray,thick](8.0,-0.5) -- (5.5,-0.5) -- (5.5,0.5) -- (8.0,0.5);
%
%MIDDLE
\begin{scope}
\draw[thick,red](2.2,0.5) arc (-180:-360:1.8cm and 2.2cm);
\draw[thick,red](2.3,0.5) arc (-180:-360:1.7cm and 1.5cm);
\draw[thick,red](2.4,0.5) arc (-180:-360:1.6cm and 0.9cm);
%
\draw[thick,](2.5,+0.3) to [bend left=50] (5.5,+0.3);
\draw[thick,](2.5,+0.2) to [bend left=25] (5.5,+0.2);
\draw[thick,](2.5,+0.1) to [bend left=15] (5.5,+0.1);
\draw[thick,](2.5,+0.0) to [bend left=5] (5.5,+0.0);
%
\draw[thick,](2.5,+0.0) to [bend right=5] (5.5,+0.0);
\draw[thick,](2.5,-0.1) to [bend right=15] (5.5,-0.1);
\draw[thick,](2.5,-0.2) to [bend right=25] (5.5,-0.2);
\draw[thick,](2.5,-0.3) to [bend right=50] (5.5,-0.3);
%
\draw[thick,blue](2.4,-0.5) arc (-180:0:1.6cm and 0.9cm);
\draw[thick,blue](2.3,-0.5) arc (-180:0:1.7cm and 1.5cm);
\draw[thick,blue](2.2,-0.5) arc (-180:0:1.8cm and 2.2cm);
\end{scope}
%
%LEFT MAGNET
\draw[thick,-latex](2.0,0.5) to [bend left=20] (2.6,2.9);
\draw[thick,-latex](1.9,0.5) to [bend left=5] (1.9,2.7);
\draw[thick,-latex](1.8,0.5) to [bend right=5] (1.4,2.5);
\draw[thick,-latex](1.6,0.5) to [bend right=13] (1.0,2.2);
\draw[thick,-latex](1.4,0.5) to [bend right=15] (0.7,1.9);
\draw[thick,-latex](1.1,0.5) to [bend right=17] (0.4,1.5);
\draw[thick,-latex](0.8,0.5) to [bend right=27] (0.1,1.2);
%
\draw[thick,-latex](2.0,-0.5) to [bend right=20] (2.6,-2.9);
\draw[thick,-latex](1.9,-0.5) to [bend right=5] (1.9,-2.7);
\draw[thick,-latex](1.8,-0.5) to [bend left=5] (1.4,-2.5);
\draw[thick,-latex](1.6,-0.5) to [bend left=13] (1.0,-2.2);
\draw[thick,-latex](1.4,-0.5) to [bend left=15] (0.7,-1.9);
\draw[thick,-latex](1.1,-0.5) to [bend left=17] (0.4,-1.5);
\draw[thick,-latex](0.8,-0.5) to [bend left=27] (0.1,-1.2);
%
%RIGHT MAGNET
\draw[thick,](8-2.0,0.5) to [bend right=20] (8-2.6,2.9);
\draw[thick,](8-1.9,0.5) to [bend right=5] (8-1.9,2.7);
\draw[thick,](8-1.8,0.5) to [bend left=5] (8-1.4,2.5);
\draw[thick,](8-1.6,0.5) to [bend left=13] (8-1.0,2.2);
\draw[thick,](8-1.4,0.5) to [bend left=15] (8-0.7,1.9);
\draw[thick,](8-1.1,0.5) to [bend left=17] (8-0.4,1.5);
\draw[thick,](8-0.8,0.5) to [bend left=27] (8-0.1,1.2);
%
\draw[thick,](8-2.0,-0.5) to [bend left=20] (8-2.6,-2.9);
\draw[thick,](8-1.9,-0.5) to [bend left=5] (8-1.9,-2.7);
\draw[thick,](8-1.8,-0.5) to [bend right=5] (8-1.4,-2.5);
\draw[thick,](8-1.6,-0.5) to [bend right=13] (8-1.0,-2.2);
\draw[thick,](8-1.4,-0.5) to [bend right=15] (8-0.7,-1.9);
\draw[thick,](8-1.1,-0.5) to [bend right=17] (8-0.4,-1.5);
\draw[thick,](8-0.8,-0.5) to [bend right=27] (8-0.1,-1.2);
\end{tikzpicture}
\end{document}

答案1

谢谢@Roland,效果非常好!

修复后的图像

\tikzset{middlearrow/.style={
        decoration={markings,
            mark= at position 0.5 with {\arrow{#1}} ,
        },
        postaction={decorate}
    }
}   
\begin{tikzpicture}
%MAGNET
\fill[gray!60](0,-0.5) rectangle (2.5,0.5);
\fill[gray!60](5.5,-0.5) rectangle (8.0,0.5);
%
\node at (2.2,0) {\Large X};
\node at (5.8,0) {\Large Y};
%
\draw[gray,thick](0,-0.5) -- (2.5,-0.5) -- (2.5,0.5) -- (0,0.5);
\draw[gray,thick](8.0,-0.5) -- (5.5,-0.5) -- (5.5,0.5) -- (8.0,0.5);
%
%MIDDLE
\begin{scope}
\draw[thick,middlearrow={latex}](2.2,0.5) arc (-180:-360:1.8cm and 2.2cm);
\draw[thick,middlearrow={latex}](2.3,0.5) arc (-180:-360:1.7cm and 1.5cm);
\draw[thick,middlearrow={latex}](2.4,0.5) arc (-180:-360:1.6cm and 0.9cm);
%
\draw[thick,middlearrow={latex}](2.5,+0.3) to [bend left=50] (5.5,+0.3);
\draw[thick,middlearrow={latex}](2.5,+0.2) to [bend left=25] (5.5,+0.2);
\draw[thick,middlearrow={latex}](2.5,+0.1) to [bend left=15] (5.5,+0.1);
\draw[thick,middlearrow={latex}](2.5,+0.0) to [bend left=5] (5.5,+0.0);
%
\draw[thick,middlearrow={latex}](2.5,+0.0) to [bend right=5] (5.5,+0.0);
\draw[thick,middlearrow={latex}](2.5,-0.1) to [bend right=15] (5.5,-0.1);
\draw[thick,middlearrow={latex}](2.5,-0.2) to [bend right=25] (5.5,-0.2);
\draw[thick,middlearrow={latex}](2.5,-0.3) to [bend right=50] (5.5,-0.3);
%
\draw[thick,middlearrow={latex}](2.4,-0.5) arc (-180:0:1.6cm and 0.9cm);
\draw[thick,middlearrow={latex}](2.3,-0.5) arc (-180:0:1.7cm and 1.5cm);
\draw[thick,middlearrow={latex}](2.2,-0.5) arc (-180:0:1.8cm and 2.2cm);
\end{scope}
%
%LEFT MAGNET
\draw[thick,-latex](2.0,0.5) to [bend left=20] (2.6,2.9);
\draw[thick,-latex](1.9,0.5) to [bend left=5] (1.9,2.7);
\draw[thick,-latex](1.8,0.5) to [bend right=5] (1.4,2.5);
\draw[thick,-latex](1.6,0.5) to [bend right=13] (1.0,2.2);
\draw[thick,-latex](1.4,0.5) to [bend right=15] (0.7,1.9);
\draw[thick,-latex](1.1,0.5) to [bend right=17] (0.4,1.5);
\draw[thick,-latex](0.8,0.5) to [bend right=27] (0.1,1.2);
%
\draw[thick,-latex](2.0,-0.5) to [bend right=20] (2.6,-2.9);
\draw[thick,-latex](1.9,-0.5) to [bend right=5] (1.9,-2.7);
\draw[thick,-latex](1.8,-0.5) to [bend left=5] (1.4,-2.5);
\draw[thick,-latex](1.6,-0.5) to [bend left=13] (1.0,-2.2);
\draw[thick,-latex](1.4,-0.5) to [bend left=15] (0.7,-1.9);
\draw[thick,-latex](1.1,-0.5) to [bend left=17] (0.4,-1.5);
\draw[thick,-latex](0.8,-0.5) to [bend left=27] (0.1,-1.2);
%
%RIGHT MAGNET
\draw[thick,middlearrow={latex}](8-2.6,2.9) to [bend left=20] (8-2.0,0.5);
\draw[thick,middlearrow={latex}](8-1.9,2.7) to [bend left=5] (8-1.9,0.5);
\draw[thick,middlearrow={latex}](8-1.4,2.5) to [bend right=5] (8-1.8,0.5);
\draw[thick,middlearrow={latex}](8-1.0,2.2) to [bend right=13] (8-1.6,0.5);
\draw[thick,middlearrow={latex}](8-0.7,1.9) to [bend right=15] (8-1.4,0.5);
\draw[thick,middlearrow={latex}](8-0.4,1.5) to [bend right=17] (8-1.1,0.5);
\draw[thick,middlearrow={latex}](8-0.1,1.2) to [bend right=27] (8-0.8,0.5);
%
%
\draw[thick,middlearrow={latex}](8-2.6,-2.9) to [bend right=20] (8-2.0,-0.5);
\draw[thick,middlearrow={latex}](8-1.9,-2.7) to [bend right=5] (8-1.9,-0.5);
\draw[thick,middlearrow={latex}](8-1.4,-2.5) to [bend left=5] (8-1.8,-0.5);
\draw[thick,middlearrow={latex}](8-1.0,-2.2) to [bend left=13] (8-1.6,-0.5);
\draw[thick,middlearrow={latex}](8-0.7,-1.9) to [bend left=15] (8-1.4,-0.5);
\draw[thick,middlearrow={latex}](8-0.4,-1.5) to [bend left=17] (8-1.1,-0.5);
\draw[thick,middlearrow={latex}](8-0.1,-1.2) to [bend left=27] (8-0.8,-0.5);
\end{tikzpicture}

相关内容