An alternative, in the form of tkz-euclide
.
\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A} \tkzDefPoint(2,2){B}
\tkzDefPoint(0,2){C} \tkzDefPoint(2,0){D}
\tkzDrawSegments(A,B C,D)
\tkzInterLL(A,B)(C,D) \tkzGetPoint{E}
\tkzDrawPoints(E) \tkzLabelPoints[below](E)
\end{tikzpicture}
\end{document}
The first three lines define the points and draw the line segments between them. \tkzInterLL
compute the intersection of the lines A--B
and C--D
, while \tkzGetPoint{E}
gives the point a name. Finally the point is drawn and labeled.
You can mix this with "normal" TikZ code if you want to, e.g. (borrowing from Tom Bombadil):
\documentclass{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (3,3);
\coordinate (C) at (3,0);
\coordinate (D) at (0,1);
\draw (A) -- (B);
\draw (C) -- (D);
\tkzInterLL(A,B)(C,D) \tkzGetPoint{E}
\node [fill=red,inner sep=1pt,label=-90:$E$] at (E) {};
\end{tikzpicture}
\end{document}
This only uses tkz-euclide
to find and name the intersection.
(intersection of c1--c2 and c3--c4)
.