答案1
这个怎么样?几个圆、椭圆、剪辑,你就有了。我(几乎)用参数做了所有事情,所以你可以根据需要更改尺寸。
但是,它可能不是您的第一幅 tikz 绘图的最佳示例。
\documentclass [tikz, border=2mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
% Arrow for the ellipse
\tikzstyle{arrowe}=[red, decoration={markings,mark=at position 0.45 with {\arrow[scale=1.5,>=stealth]{<}}},postaction={decorate}]
% Arros for the arc
\tikzstyle{arrowb}=[red, decoration={markings,mark=at position 0.75 with {\arrow[scale=1.5,>=stealth]{>}}},postaction={decorate}]
% parameters
\def\a {0.6} % ellipse x-axis
\def\b {1} % ellipse y-axis
\def\x {6} % x distance between ellipses
\def\y {4} % y distance between ellipses
\def\w {1.75} % width (at the middle section)
\def\xt{0.15} % x of tanget point
\pgfmathsetmacro\yt{\b/\a*sqrt(\a*\a-\xt*\xt)} % y of tangent point
\pgfmathsetmacro\m {(\a*\a*\yt)/(\b*\b*\xt)} % normal slope
\pgfmathsetmacro\yc{\y+\b+\yt+\m*(\x-\xt)} % arc center
\pgfmathsetmacro\r {sqrt((\x-\xt)*(\x-\xt)+(\y+\yt-\yc)*(\y+\yt-\yc))} % arc radius
\pgfmathsetmacro\h {\yc-\r} % height (at the middle section)
\pgfmathsetmacro\aa{\x-\w} % semiellipse x-axis
\pgfmathsetmacro\bb{\y-\b} % semiellipse y-axis
% red lines parameters
\def\rl{4} % little arc radius
\def\rb{18} % big arc radius
\def\s {0.5} % distance red and black semiellipses
\pgfmathsetmacro\yl{sqrt(\rl*\rl-\w*\w)} % little arc center
\pgfmathsetmacro\xb{sqrt(\rb*\rb-\h*\h)} % big arc center
\pgfmathsetmacro\ar{\x-\w+\s} % red semiellipse x-axis
% red lines (except for semiellipse)
\begin{scope}
\clip (-\x,-\y) rectangle (\x,0);
\draw[arrowb] (0,\yl) circle (\rl cm);
\end{scope}
\begin{scope}
\clip (0,-\h) rectangle (\x,\h);
\draw[arrowb](-\xb,0) circle (\rb cm);
\end{scope}
% ellipses
\foreach\i/\j in {-\x/-\y, -\x/\y, \x/-\y, \x/\y}
{
\draw (\i,\j) ellipse (\a cm and \b cm);
}
% arcs and semiellipses
\begin{scope}
\clip (\x-\xt,\y+\yt) -- (-\x+\xt,\y+\yt) -- (-\x,\y-\b) -- (-\x,-\y+\b) --
(-\x+\xt,-\y-\yt) -- (\x-\xt,-\y-\yt) -- (\x,-\y+\b) -- (\x,\y-\b) -- cycle;
\draw[arrowe] (\x,0) ellipse (\ar cm and \bb cm); % red semiellipse
\draw (-\x,0) ellipse (\aa cm and \bb cm);
\draw ( \x,0) ellipse (\aa cm and \bb cm);
\draw (0, \yc) circle (\r cm);
\draw (0,-\yc) circle (\r cm);
\end{scope}
% labels
\node at (0,\h) [above] {$i\pi$};
\node at (0,-\h) [below] {$-i\pi\phantom{-}$};
\node[red] at (0 ,-0.1) {$A$};
\node[red] at (1.6, 1.5) {$B$};
\end{tikzpicture}
\end{document}