I'm trying to draw a curve using two seperate paths.
The Line I want to draw should use path=\pathX and use path=\pathY
but I don't want it to draw the entire paths which is why I helped myself clipping both paths. I'd also like to join both path segments with lines on either end which I somehow
achieved. Yet I would like all four segments to be drawn as one continuous curve unlike
what you see in the graphic I attached.
My MWE is as follows.
\documentclass[tikz]{standalone}
\usepackage[]{tikz}
\usetikzlibrary{%
calc,%
intersections,%
}%
\begin{document}
\def\dimx{5}
\def\dimy{5}
\begin{tikzpicture}[]
\path [name path=I, save path=\pathI] ($.25*(\dimx,0)$) rectangle ($.75*(\dimx,0) + .85*(0,\dimy)$);
\coordinate [] (p11) at ($0.1*(0,\dimy) + .1*(\dimx,0)$);
\coordinate [] (p12) at ($0.65*(0,\dimy) + .9*(\dimx,0)$);
\coordinate [] (p21) at ($0.2*(0,\dimy) + .1*(\dimx,0)$);
\coordinate [] (p22) at ($0.95*(0,\dimy) + .9*(\dimx,0)$);
\draw [name path=p1, save path=\pathC]
(p11) to [out=25, in=220] node [at end, anchor=west] {$p_1$} (p12);
\draw [name path=p2, save path=\pathA]
(p21) to [out=35, in=230] node [at end, anchor=west] {$p_2$} (p22);
\path [name intersections={of=p1 and I}] coordinate (4) at (intersection-2);
\path [name intersections={of=p1 and I}] coordinate (1) at (intersection-1);
\path [name intersections={of=p2 and I}] coordinate (3) at (intersection-2);
\path [name intersections={of=p2 and I}] coordinate (2) at (intersection-1);
\begin{scope}[]
\path [clip, use path=\pathI];
\path [name path=p1, save path=\pathX]
(p21) to [out=35, in=230]
node [at end, anchor=west] {$p_1$}
coordinate [pos=0.15] (A)
coordinate [pos=0.7] (B)
(p22);
\path [name path=p3, save path=\pathY]
(p11) to [out=25, in=220]
node [at end, anchor=west] {$p_3$}
(p12);
\draw [thick, blue] edge [use path=\pathY] edge [use path=\pathX];
\end{scope}
\draw [thick, blue] (1) -- (2) (3) -- (4);
\end{tikzpicture}
\end{document}
I might be using a completely wrong approach here but that's as far as google and the pgf manual got me. Any suggestions I'll greatly appreciate. Thanks in advance.
