2

Consider

\documentclass[margin = 12mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{bending}

\begin{document}
\begin{tikzpicture}
    \draw[bend right = 40, name path = a] (0, 0) edge (2, 0);
    \draw[bend left = 40, name path = b] (0, -.5) edge (2, -.5);
    \path[name intersections = {of = a and b}];

    \draw[name path = c] (3.5, 0) -- (3, -.5);
    \draw[name path = d] (3.5, -.5) -- (3, 0);
    \path[name intersections = {of = c and d}];

    \fill (intersection-1) circle (1pt);
\end{tikzpicture}
\end{document}

Which looks like this: Two bent intersecting lines, tikz intersection not showing

I would expect the filled circle to appear where the two curved lines first intersect. But the intersections of the two curved lines is actually not marked.

I also tried naming the bent paths after beding (postaction = {name path = a}), but the intersection still doesn't show up.

How can I fix this without using actual bezier curves (.. controls ..)?

1 Answers1

6

You can:

  1. Name your edges:
\documentclass[tikz, margin = 1mm]{standalone}
\usetikzlibrary{bending, intersections}

\begin{document}

\begin{tikzpicture}
    \draw[bend right = 40] (0, 0) edge[name path=a] (2, 0);
    \draw[bend left = 40] (0, -.5) edge[name path=b] (2, -.5);
    \path[name intersections={of=a and b}];
    \fill (intersection-1) circle[radius=1pt];

    \draw[name path = c] (3.5, 0) -- (3, -.5);
    \draw[name path = d] (3.5, -.5) -- (3, 0);

\end{tikzpicture}

\end{document}

or

  1. Use the to operation:
\documentclass[tikz, margin = 1mm]{standalone}
\usetikzlibrary{bending, intersections}

\begin{document}

\begin{tikzpicture}
    \draw[bend right = 40, name path=a] (0, 0) to (2, 0);
    \draw[bend left = 40, name path=b] (0, -.5) to (2, -.5);
    \path[name intersections={of=a and b}];
    \fill (intersection-1) circle[radius=1pt];

    \draw[name path = c] (3.5, 0) -- (3, -.5);
    \draw[name path = d] (3.5, -.5) -- (3, 0);

\end{tikzpicture}

\end{document}

Also possible (better?):

\draw[name path=a] (0, 0) to[bend right = 40] (2, 0);
\draw[name path=b] (0, -.5) to[bend left = 40] (2, -.5);

Both codes yield the same output:

enter image description here

Beware that circle (1pt) is an obsolete syntax that can lead to problems (see also here, and pgfplots issue number 232). Better use circle[radius=1pt] as I did above.

frougon
  • 24,283
  • 1
  • 32
  • 55