# Tikz : Extend an inclined line

is it possible to ask tikz to extend an inclined line (not parallel to x and y) to a value xmax or ymax as is done between a horizontal and a vertical line.

i know it's feasible by having the intersection calculated by tikz, but as i have a lot of line to stop i would like to avoid

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (5,0) coordinate(A) -- ++ (0,3);
\node[below]at (A){A};
\draw (0,1) coordinate (B) -- (A|-B);
\node[left]at (B){B};
\draw(B) -- ++(10:6);

\end{tikzpicture}
\end{document}


## 2 Answers

You can start the path in the correct direction and then use intersection:

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (5,0) coordinate(A) -- ++ (0,3) coordinate (A');
\node[below]at (A){A};
\draw (0,1) coordinate (B) -- (A|-B);
\node[left]at (B){B};
\draw (B) -- ++(10:1)coordinate(B') --(intersection of  A--A' and B--B');

\end{tikzpicture}
\end{document}


• Just a note: this intersection coordinate system is not documented, and according to a comment in pgfmanual-en-tikz-coordinates.tex (line 468) it is considered deprecated. (I don't know why, the implementation obviously hasn't been removed, as it still works.) – Torbjørn T. Mar 10 '18 at 19:25
• interestingly, op in question ask for solution without use of intersections, but than accept answer using them. i'm slightly confused now :-(. – Zarko Mar 10 '18 at 20:28

with small knowledge of geometry:

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
\begin{tikzpicture}
\draw (5,0) coordinate[label=below:A] (A) -- ++ (0,3);
\draw (0,1) coordinate[label= left:B] (B) -- (A|-B);
\draw[red] (B) -- ++(10:{5/cos(10)});
\end{tikzpicture}
\end{document}


where 5 is distance between coordinate and line above coordinate A, resented by black horizontal line.