My script calculates several intersections of lines (green) with a vertical "wall" (not shown). The intersections (small red dots) are fine. But the lines from one intersection to another intersection are too short (blue). I don't have any idea what's wrong with the script:
\documentclass[a4paper]{scrartcl}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{intersections,calc}
\begin{document}
\begin{tikzpicture}
\def\wallx{6cm}
\def\scannerx{0cm}
\def\scannery{0.0cm}
\def\scannerradius{0.4cm}
\def\walllength{8cm}
\coordinate (WALLBEGIN) at ($(\wallx, 0.5*\walllength)$);
\coordinate (WALLEND) at ($(\wallx, -0.5*\walllength)$);
\coordinate (SCANNER) at (\scannerx, \scannery);
\path[name path=wall] (WALLBEGIN) -- (WALLEND);
%calculate intersections
\foreach \index in {0,...,4} {
%calculates the ray from scanner to wall
\def\raylength{12cm}
\coordinate (REL) at ({9*(\index-2)+1}:\raylength);
\coordinate (RAYEND) at ($(SCANNER)+(REL)$);
\path [name path=ray] (SCANNER) -- (RAYEND);
%intersection with wall
\path [name intersections={of=ray and wall,by=X}];
\node (iwall\index) at (X) {};
%THIS INTERSECTION IS OK
\filldraw[fill=red] (X) circle (0.05cm);
\draw[green] (SCANNER) -- (RAYEND);
}
% LINE BETWEEN TWO INTERSECTIONS WHICH IS TOO SHORT
\draw[blue] (iwall0) -- (iwall1);
\filldraw[fill=gray!50!white] (SCANNER) circle (\scannerradius);
\end{tikzpicture}
\end{document}

\coordinate (iwall\index)instead of\nodefixes the problem.coordinatenodes don't take up any space, while emptynodes still have the white space caused by theinner sep. – Jake Apr 28 '12 at 19:30\draw[blue] (iwall0.center) -- (iwall1.center);– Marco Daniel Apr 28 '12 at 19:31