Maybe I'm misunderstanding the question, but I believe all you have to do is move the line
style from the straight-line \path
command to the connect
path. That will leave the straight line invisible, and apply the line
style (with the arrow head) to the connecting line with the arc:
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes,arrows,shapes.multipart}
\begin{document}
\begin{tikzpicture}[node distance = 3.00cm, auto, ]
\tikzset{
decision/.style = {diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt},
block/.style = {rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em},
subroutine/.style = {draw,rectangle split, rectangle split horizontal,
rectangle split parts=3,minimum height=1cm,
rectangle split part fill={red!50, green!50, blue!20, yellow!50}},
connector/.style = {draw,circle,node distance=3cm,fill=yellow!20},
data/.style = {draw, trapezium,node distance=1.5cm,fill=olive!20}
}
\tikzset{
connect/.style args={(#1) to (#2) over (#3) by #4}{
insert path={
let \p1=($(#1)-(#3)$), \n1={veclen(\x1,\y1)},
\n2={atan2(\x1,\y1)}, \n3={abs(#4)}, \n4={#4>0 ?180:-180} in
(#1) -- ($(#1)!\n1-\n3!(#3)$)
arc (\n2:\n2+\n4:\n3) -- (#2)
}
},
}
\node [block,fill=green] (cs110) {\textbf{CS110} \emph{CS Class 1}};
\node[block,fill=blue,right of=cs110] (cs120){\textbf{CS120} \emph{CS Class 2}};
\node[block,fill=red, above of=cs120] (cs220) {Test 3};
\node[block,fill=orange,right of = cs220] (cs330) {Test 4};
\path[ name path=120to220] (cs120) -- (cs220);
\path[line, name path = 110to330] (cs110) -- (cs330);
\path[name intersections={of=120to220 and 110to330, by=inter}];
\draw [line, connect=(cs120) to (cs220) over (inter) by 5pt];
\end{tikzpicture}
\end{document}
This is a work around using \clip
.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\clip (1.3,0.2) -- (1,0) -- (1.3,-0.2) -- (1.3,0.2) -- cycle;
\draw [line width=2pt] (1.3,0.2) to (1,0) to (1.3,-0.2);
\draw (1.3,-0.2) to (1.3,0.2);
\end{tikzpicture}
\end{document}
Note that a line width of 2pt
will give a resultant line width of 1pt
as the other part is clipped off. So you have to adjust properly.
If this forms a part of bigger diagram, the \clip
ping part may be enclosed in a scope
so as to limit the clipping:
\begin{scope}
\clip (1.3,0.2) -- (1,0) -- (1.3,-0.2) -- (1.3,0.2) -- cycle;
\draw [line width=2pt] (1.3,0.2) to (1,0) to (1.3,-0.2);
\draw (1.3,-0.2) to (1.3,0.2);
\end{scope}
Best Answer
The
miter
option is more "correct" in that it doesn't add new corners to a shape or introduce rounding. In some cases with very sharp angles, the results might be undesirable though, as in the question you linked to. Consider a right angle with different join types: These could be corners of a rectangle. Only the standardmiter
option would be what you would intuitively expect.