# tikz line are not perfectly intersecting [duplicate]

Here is my code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}

\fill[gray!50] (0,2.5) -- (2,2.5) -- ++(60:.2) -- ++(-2,0) -- cycle;
\fill[gray!50] (0,2.5) -- (2,2.5) -- ++(0,-.2) -- ++(-2,0) -- cycle;
\fill[gray!50] (2,2.5) -- ++(60:.2) -- ++(0,-.2) -- ++(60:-.2) -- cycle;

\begin{scope}[shift={(60:1.3)}]
\fill[gray!50] (0,2.5)  -- (2,2.5) -- ++(60:.2) -- ++(-2,0) -- cycle;
\fill[gray!50] (0,2.5) -- (2,2.5) -- ++(0,-.2) -- ++(-2,0) -- cycle;
\fill[gray!50] (2,2.5) -- ++(60:.2) -- ++(0,-.2) -- ++(60:-.2) -- cycle;
\end{scope}

%see here first will be helpful to understand
\draw (0,0) -- (2,0) -- (2,2.5) -- (0,2.5) -- cycle;
\draw (2,0) -- ++(60:1.5) -- ++(0,2.5) coordinate (a) -- ++(60:-.2) -- ++(0,-.2) -- ++(60:-1.1) -- ++(0,.2) -- ++(60:-.2);
\draw (a) -- ++(-2,0) -- ++(60:-.2) coordinate (b) -- ++(2,0);
\draw (b) -- ++(0,-.2) coordinate (c) -- ++(60:-.87);
\draw[densely dotted] (c) -- ++(2,0);
\draw (0,2.5) -- ++(60:.2) -- ++(2,0) -- ++(60:-.2) -- cycle;

\end{tikzpicture}
\end{document}


The result of the code is in the figure, and I wonder why the part marked in red is not perfectly drawn.

• You should consider changing the join cap. Jun 2 '17 at 2:37
• Jun 2 '17 at 8:19

So, that is the reason for the problem, now how to fix it. As stated in the comment the easiest way is to have not sharp corners. As an argument to the tikzpicture you can say [line join=round]. That will directly make all the corners more aligned:
\draw[green] (0,2.5) -- ++(60:.2) -- ++(2,0) -- ++(60:-.2) -- cycle;