在 TikZ 中,我希望此曲线绕椭圆弯曲。但无论我将角度设置得多高,它都不会弯曲那么远。有办法吗?
最小工作示例:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{>={Latex[width=2mm,length=2mm]}}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\draw[fill=black] (6,8) circle [radius=0.1];
\draw (6,6.2) ellipse (2.5cm and 0.7cm);
\draw[fill=black] (6,4.5) circle [radius=0.1];
\draw[->] (6,4.5) to[bend left=80] (5.9,8);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
答案1
答案2
对于coordinate
s 或node
sA
和B
,得到完全控制曲线从A
到B
,使用controls
\draw (A) .. controls +(<out shooting angle>:<out shooting force>) and +(<in shooting angle>:<in shooting force>) .. (B);
我改进了你的代码:使用node
而不是coordinate
,这样你就不需要手动调整以使箭头接触点。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{>={Latex[width=2mm,length=2mm]}}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=2pt}]
\path (0,2) node[dot] (U) {} (0,-2) node[dot] (L) {};
\draw (0,0) ellipse(2.5 and .7);
\draw[->,red] (L) .. controls +(170:2) and +(-170:2) .. (U);
\draw[->,blue] (L) .. controls +(45:3) and +(-45:3) .. (U);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
呼喊力度越大,距离越远。使用大呼喊力度时,为了使包围盒不更大,请使用\clip
。
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}[dot/.style={circle,fill,inner sep=2pt}]
\clip (-4,-2.5) rectangle (4,2.5); % to make bounding box not larger (when using big shouting forces).
\path (0,2) node[dot] (U) {} (0,-2) node[dot] (L) {};
\draw (0,0) ellipse(2.5 and .7);
% the bigger in/out shouting forces
\draw[-stealth,red] (L) .. controls +(170:4) and +(-170:4) .. (U);
\draw[-stealth,blue] (L) .. controls +(35:6) and +(-35:6) .. (U);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
答案3
我添加这一行left =-80
\draw[->] (6,4.5) to[bend left=-80] (5.9,8);
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{>={Latex[width=2mm,length=2mm]}}
\usetikzlibrary{decorations.pathmorphing,shapes,snakes}
\usetikzlibrary{calc}
\usetikzlibrary{arrows, decorations.markings}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}{}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\draw[fill=black] (6,8) circle [radius=0.1];
\draw (6,6.2) ellipse (2.5cm and 0.7cm);
\draw[fill=black] (6,4.5) circle [radius=0.1];
\draw[-] (6,4.5) to[bend left=80] (5.9,8);
\draw[<-] (6,4.5) to[bend left=-80] (5.9,8);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}