我想绘制下图:
我使用了 Geogebra 中生成的以下代码,但它并没有生成我想要的图表。
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.7cm,y=0.7cm]
\draw (0,4)-- (4,0);
\draw (4,0)-- (0,-4);
\draw (0,-4)-- (-4,0);
\draw (-4,0)-- (0,4);
\draw (5.41,-0.03)-- (9.41,3.97);
\draw (9.41,3.97)-- (13.41,-0.03);
\draw (13.41,-0.03)-- (9.41,-4.03);
\draw (9.41,-4.03)-- (5.41,-0.03);
\draw [->] (2,2) -- (1.47,2.53);
\draw [->] (-1.59,2.41) -- (-2.26,1.74);
\draw [->] (2.5,-1.5) -- (1.81,-2.19);
\draw [->] (-1.55,-2.45) -- (-2.34,-1.66);
\draw [->] (7.11,1.66) -- (7.67,2.22);
\draw [->] (11.29,-2.16) -- (11.85,-1.59);
\draw [->] (11.26,2.12) -- (11.89,1.5);
\draw [->] (6.9,-1.51) -- (7.98,-2.59);
\draw [shift={(2.18,3.21)}] plot[domain=4.22:5.23,variable=\t]({1*3.69*cos(\t r)+0*3.69*sin(\t r)},{0*3.69*cos(\t r)+1*3.69*sin(\t r)});
\draw [shift={(2.26,-2.4)}] plot[domain=0.94:2.23,variable=\t]({1*2.97*cos(\t r)+0*2.97*sin(\t r)},{0*2.97*cos(\t r)+1*2.97*sin(\t r)});
\draw [shift={(7.17,-1.78)}] plot[domain=0.81:2.36,variable=\t]({1*2.48*cos(\t r)+0*2.48*sin(\t r)},{0*2.48*cos(\t r)+1*2.48*sin(\t r)});
\draw [shift={(7.12,2.08)}] plot[domain=4.03:5.42,variable=\t]({1*2.71*cos(\t r)+0*2.71*sin(\t r)},{0*2.71*cos(\t r)+1*2.71*sin(\t r)});
\draw (2.46,-2.36) node {$b1$};
\draw (2.67,2.47) node {$a1$};
\draw (-2.17,2.32) node {$b1$};
\draw (-2.44,-2.18) node {$a1$};
\draw (-2.13,0.07) node {$T1$};
\draw (7.39,2.26) node {$b2$};
\draw (12.1,-2.06) node {$b2$};
\draw (10.43,-0.69) node {$T2$};
\draw (11.98,2.38) node {$a2$};
\draw (7.17,-2.24) node {$a2$};
\end{tikzpicture}
答案1
为了绘制这条曲线,我使用了操作Curve-To
(参见手册 3.0.1a 第 149 页)。
\draw [postaction={decorate}](4,0)..controls +(-4,-2.5) and +(-4,2.5).. (4,0);
为了将箭头放在中间,我使用了@Caramdir 的答案TikZ:如何在线中间画箭头?
简化代码是可能的。我这样做并不是为了让你能理解所做的更改。但只要你愿意,总是可以做到的。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>={Triangle[]},scale=.7]
\draw (0,4)-- (4,0);
\draw (4,0)-- (0,-4);
\draw (0,-4)-- (-4,0);
\draw (-4,0)-- (0,4);
\draw (5.41,-0.03)-- (9.41,3.97);
\draw (9.41,3.97)-- (13.41,-0.03);
\draw (13.41,-0.03)-- (9.41,-4.03);
\draw (9.41,-4.03)-- (5.41,-0.03);
\draw [->] (2,2) -- (1.47,2.53);
\draw [->] (-1.59,2.41) -- (-2.26,1.74);
\draw [->] (2.5,-1.5) -- (1.81,-2.19);
\draw [->] (-1.55,-2.45) -- (-2.34,-1.66);
\draw [->] (7.11,1.66) -- (7.67,2.22);
\draw [->] (11.29,-2.16) -- (11.85,-1.59);
\draw [->] (11.26,2.12) -- (11.89,1.5);
\draw [->] (6.9,-1.51) -- (7.98,-2.59);
% arrow in the middle from https://tex.stackexchange.com/a/3172/138900
\begin{scope}[decoration={markings,mark=at position 0.5 with {\arrow{>}}}]
\draw [postaction={decorate},fill=gray!50](4,0)..controls +(-4,-2.5) and +(-4,2.5).. (4,0);
\draw [postaction={decorate},fill=gray!50](5.41,-0.03)..controls +(4,-2.5) and +(4,2.5).. (5.41,-0.03);
\end{scope}
\draw (2.46,-2.36) node {$b1$};
\draw (2.67,2.47) node {$a1$};
\draw (-2.17,2.32) node {$b1$};
\draw (-2.44,-2.18) node {$a1$};
\draw (-2.13,0.07) node {$T1$};
\draw (7.39,2.26) node {$b2$};
\draw (12.1,-2.06) node {$b2$};
\draw (10.43,-0.69) node {$T2$};
\draw (11.98,2.38) node {$a2$};
\draw (7.17,-2.24) node {$a2$};
\end{tikzpicture}
\end{document}
答案2
另一种选择与@AndréC 答案的想法相同,但没有范围,而是to
用controls
\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.7cm,y=0.7cm, decoration={markings, mark=at position 0.52 with {\arrow{>}}}]
\draw (0,4)-- (4,0);
\draw (4,0)-- (0,-4);
\draw (0,-4)-- (-4,0);
\draw (-4,0)-- (0,4);
\draw (5.41,-0.03)-- (9.41,3.97);
\draw (9.41,3.97)-- (13.41,-0.03);
\draw (13.41,-0.03)-- (9.41,-4.03);
\draw (9.41,-4.03)-- (5.41,-0.03);
\draw [->] (2,2) -- (1.47,2.53);
\draw [->] (-1.59,2.41) -- (-2.26,1.74);
\draw [->] (2.5,-1.5) -- (1.81,-2.19);
\draw [->] (-1.55,-2.45) -- (-2.34,-1.66);
\draw [->] (7.11,1.66) -- (7.67,2.22);
\draw [->] (11.29,-2.16) -- (11.85,-1.59);
\draw [->] (11.26,2.12) -- (11.89,1.5);
\draw [->] (6.9,-1.51) -- (7.98,-2.59);
%\draw [shift={(2.18,3.21)}] plot[domain=4.22:5.23,variable=\t]({1*3.69*cos(\t r)+0*3.69*sin(\t r)},{0*3.69*cos(\t r)+1*3.69*sin(\t r)});
%\draw [shift={(2.26,-2.4)}] plot[domain=0.94:2.23,variable=\t]({1*2.97*cos(\t r)+0*2.97*sin(\t r)},{0*2.97*cos(\t r)+1*2.97*sin(\t r)});
%\draw [shift={(7.17,-1.78)}] plot[domain=0.81:2.36,variable=\t]({1*2.48*cos(\t r)+0*2.48*sin(\t r)},{0*2.48*cos(\t r)+1*2.48*sin(\t r)});
%\draw [shift={(7.12,2.08)}] plot[domain=4.03:5.42,variable=\t]({1*2.71*cos(\t r)+0*2.71*sin(\t r)},{0*2.71*cos(\t r)+1*2.71*sin(\t r)});
\draw[fill=gray,,postaction={decorate}] (4,0) to[in=270, out=225] (1,0) to[in=135, out=90] (4,0);
\draw[fill=gray,,postaction={decorate}] (5.42,0) to[in=270, out=315] (8.42,0) to[in=45, out=90] (5.42,0);
\draw (2.46,-2.36) node {$b1$};
\draw (2.67,2.47) node {$a1$};
\draw (-2.17,2.32) node {$b1$};
\draw (-2.44,-2.18) node {$a1$};
\draw (-2.13,0.07) node {$T1$};
\draw (7.39,2.26) node {$b2$};
\draw (12.1,-2.06) node {$b2$};
\draw (10.43,-0.69) node {$T2$};
\draw (11.98,2.38) node {$a2$};
\draw (7.17,-2.24) node {$a2$};
\end{tikzpicture}
\end{document}
附言:请赞同他的回答而不是我的,因为他在我之前回答了,但是在我创建代码之后他的回答才对我可见……所以,我决定将其添加为替代方案。