I want to ignore one specific path for the bounding box calculation in the middle of a tikz picture (I need the path only to get an intersection point and had to make it quite long, to be sure that the point exists).
I came up with the following solution but I find it a bit odd-looking. Does something better exist?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw(0,0)-- (2,2);
\begin{scope}
\path [use as bounding box]
(current bounding box.south west)
rectangle (current bounding box.north east);
\path (-1,-1)--(5,5); %ignore this
\end{scope}
\fill[red](0,1)rectangle (1,3);
\draw [black] (0,0)rectangle (2,3); %wanted bounding box
\draw [blue] (current bounding box.south west)
rectangle (current bounding box.north east);%current bounding box
\end{tikzpicture}
\end{document}

