Bad intersection of lines in TikZ

Consider the following:

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[line width = 4]
\coordinate (a) at (0,0);
\coordinate (b) at (1,0);
\coordinate (c) at (1,1);
\draw (a) -- (intersection of a--b and b--c);
\draw (c) -- (intersection of a--b and b--c);
\end{tikzpicture}
\end{document}


Which produces:

How can I fill the corner? Adding [cap=rounded] didn't solve the issue. I know that I could do something like \draw (a) -- (b) -- (c) but I need to obtain the same effect using intersection.

Thanks!

EDIT 1: I try to figure out how to handle two independent line segments and their intersection. For example:

\begin{tikzpicture}[scale=4,line width=7]
\coordinate (a1) at (0,0);
\coordinate (b1) at (1,1);
\coordinate (b2) at (1,-1);
\draw (b1) -- (b2);
\foreach \x in {0,20,30,40,45}
{
\coordinate (a2) at (\x:10);
\draw (a1) -- (intersection of a1--a2 and b1--b2);
}
\end{tikzpicture}


Here, I don't know in advance (well I do, but for the sake of the question I don't), where the two segments intersect and whether or not the intersection point is a common end point.

-
As Jake says in the comments to his answer, could you give a slightly more complicated example of what you are trying to do? If your lines meet at right-angles then you could add line cap=rect to make it look right. –  Loop Space May 20 '11 at 7:30

In order to get the corner right, the path should be drawn in a single \draw command. You can still use the intersection of in this:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[line width = 4]
\coordinate (a) at (0,0);
\coordinate (b) at (1,0);
\coordinate (c) at (1,1);
\draw (a) -- (intersection of a--b and b--c) -- (c);
\end{tikzpicture}
\end{document}


-
This is indeed helpful for my case, but in general I think it is not good enough. If you're plotting something with parameters, then you may not know in advance that the intersection occurs exactly at a corner. It may be some mid point or a proper intersection. Is there some more general approach? –  Dror May 20 '11 at 6:34
@Dror: Could you edit your example to include a case like the one you mention? I'm not sure I understand what you mean by "proper intersection". –  Jake May 20 '11 at 6:40
@Dror: Ah, do you mean that your two lines would not necessarily use the same intersection as their endpoints? –  Jake May 20 '11 at 6:46
@Jake: Yes - more or less. Consider my edit... –  Dror May 20 '11 at 7:38
@Jake: Oh my bad, just thought it would work as well. =) –  Paulo Cereda May 20 '11 at 10:27

I think that this is most likely best handled by a clip to chop the lines extending from (a1) at the edge of the line they are meant to be drawn to. Getting it right is a bit of a hassle (but would be near impossible without the fantastic calc library) and the following is not guaranteed to be anywhere near robust. I've tried not to assume that your lines are aligned with the axes, but I was only careful at getting the clip path right on the line from (b1) to (b2).

Incidentally, this doesn't interact well with the scale option since that scales coordinates but not line widths. So to enlarge your picture I used the x=4cm,y=4cm syntax which redefines the standard unit.

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

\begin{tikzpicture}[line width=7,y=4cm,x=4cm]
\coordinate (a1) at (0,0);
\coordinate (b1) at (1,1);
\coordinate (b2) at (1,-1);
\coordinate (ab) at ($($(b1)!(a1)!(b2)$)!-.5\pgflinewidth!(a1)$);
\coordinate (ab1) at ($(b1)!(ab)!90:(b2)$);
\coordinate (ab2) at ($(b2)!(ab)!90:(b1)$);
\draw[red] (b1) -- (b2);
\clip ($(ab1)!-1cm!(ab2)$) -- ($(ab2)!-1cm!(ab1)$) -| (a1) |-  ($(ab1)!-1cm!(ab2)$);
\foreach \x in {0,20,30,40,45}
{
\coordinate (a2) at (\x:10);
\draw (a1) -- ($(a1)!1.1!(intersection of a1--a2 and b1--b2)$);
}
\end{tikzpicture}

\end{document}

-

I think you will have to (re)draw the corners as part of a continuous path:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=4,line width=7]
\coordinate (a1) at (0,0);
\coordinate (b1) at (1,1);
\coordinate (b2) at (1,-1);
\coordinate (a0) at (0:10);
\draw (b1) -- (b2) ;
\foreach \x in {0,20,30,40,45}
{
\coordinate (a2) at (\x:10);
\draw (a1) -- (intersection of a1--a2 and b1--b2) -- (b2);
}

\draw (b1) -- (a1) -- (intersection of a1--a0 and b1--b2);
\end{tikzpicture}
\end{document}

-
I think this is a brilliant solution and I've stolen it for another answer here: tex.stackexchange.com/questions/10980/… –  Loop Space May 20 '11 at 21:39