I want to use named path to calculate the intersection of 2 line. but below example code doesn't work!
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\tikzset{
dot/.style={circle,inner sep=1pt,fill,label={\tiny #1},name=#1},
}
\node[dot=A] (A) at (0,0) {};
\node[dot=B] (B) at (1,0) {};
\node[dot=C] (C) at (0,1) {};
\node[dot=D] (D) at (1,0.5) {};
\path[name path=P1] (A) -- (B);
\path[name path=P2] (C) -- (D);
\coordinate (CS) at (intersection of P1 and P2);
%\coordinate (CS) at (intersection of A--B and C--D);
\draw (A) -- (B);
\draw (C) -- (D);
\node[dot=E] (E) at (CS) {};
\draw[dotted] (B)--(E)--(D);
\end{tikzpicture}
\end{document}
If I use the comment out line as below:
\coordinate (CS) at (intersection of A--B and C--D);
It works fine. Is it possible to use a named path as argument of intersection macro!
Best Answer
With a real intersection you can write (I changed the coordinates of D)
else