5

In TikZ, I want this curve to bend around the ellipse. But no matter how high I set the angle, it would not bend that far. Is there a way to do it?

curve

Minimal working example:

\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
  • 1
    @SandyG Corrected.
    – Alexi
    Mar 22, 2022 at 14:05

3 Answers 3

15

You can add looseness to the draw command:

\draw[->] (6,4.5) to[bend left=80, looseness=2.7] (5.9,8);

enter image description here

2

For coordinates or nodes A and B, to get full control of a curve from A to B, use controls

\draw (A) .. controls +(<out shooting angle>:<out shooting force>) and +(<in shooting angle>:<in shooting force>) .. (B);

I improve your code: use node instead of coordinate, so you don't need to manual adjust in order to the arrow touching the dot.

enter image description here

\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}

The bigger in/out shouting forces, the further distance is. When using big shouting forces, to make bounding box not larger, use \clip.

enter image description here

\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}
2
  • Maybe add/change your examples to include a case which "bend[s] around the ellipse"? Otherwise, one could get the impression that controls could not satisfy that request. E.g. +(170:4) works for me.
    – ojdo
    Mar 23, 2022 at 13:15
  • I added an update. Thanks @ojdo !
    – Black Mild
    Mar 24, 2022 at 9:06
0

I add this line with left =-80

\draw[->] (6,4.5) to[bend left=-80] (5.9,8);

enter image description here

\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} 
4
  • you can display or not the circles (6,6.2) and (5.9,8) by adding a comment % Mar 22, 2022 at 13:42
  • 4
    Why did you undo the edit that made your post readable?
    – Teepeemm
    Mar 22, 2022 at 13:53
  • I don't think that answers OP's question. You may delete your post for the sake of clearness.
    – SebGlav
    Mar 22, 2022 at 18:31
  • The question may not have been totally clear, but this is not what the OP meant by bending around the ellipse.
    – Sandy G
    Mar 23, 2022 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .