# How could I label the intersection point as O?

Moreover, how may I colour the two angles AOA' and BOB' in two different colours?

    \documentclass[11pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{color}

\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(6,5){B}
\tkzDrawSegment(A,B)
\tkzDefPoint(0,5){A^{'}}
\tkzDefPoint(6,0){B^{'}}
\tkzDrawSegment(A^{'},B^{'})
\tkzLabelPoints[xshift=-10pt](A,B,A^{'},B^{'})
\tkzDrawPoints(A,B,A^{'},B^{'})
\end{tikzpicture}
\end{document}

• I think your question is how to generate the intersection point automatically? Jan 28, 2015 at 15:25

Define the intersection of the 2 segments and save it as a point. Then color the point.

Also, as commented by @Harish, you can color the angles. Since we want the point O over the other parts, its code is at the end.

\tkzInterLL(A,B)(A^{'},B^{'})
\tkzGetPoint{O}
\tkzDrawPoint[color=red](O)


MWE

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{color}

\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(6,5){B}
\tkzDrawSegment(A,B)
\tkzDefPoint(0,5){A^{'}}
\tkzDefPoint(6,0){B^{'}}
\tkzDrawSegment(A^{'},B^{'})
\tkzLabelPoints[xshift=-10pt](A,B,A^{'},B^{'})
\tkzDrawPoints(A,B,A^{'},B^{'})
\tkzInterLL(A,B)(A^{'},B^{'})
\tkzGetPoint{O}
%% colored angles
\tkzMarkAngle[size=1 cm,draw=red,fill=blue!40](A^{'},O,A)
\tkzMarkAngle[size=1 cm,draw=blue,fill=olive!40](B^{'},O,B)
\tkzDrawPoint[color=black,size=5mm,fill=white](O)
%% label for point O
\tkzLabelPoints[yshift=8mm](O)
\end{tikzpicture}
\end{document}

• what about the intersections library? Do I need to load it? Jan 28, 2015 at 15:27
• @TroyWoo, I'm just using your code. I'll complete it. Jan 28, 2015 at 15:28
• I learned...though I am not the PO... Jan 28, 2015 at 15:29

A PSTricks solution using the pst-eucl package:

\documentclass{article}

\usepackage{pst-eucl}

\begin{document}

\psset{unit = 2, nodesep = -0.5}
\begin{pspicture}(-1.4,-1.3)(3.5,2.3)
\pstGeonode(-1,-1){A}(3,2){B}(-1,2){A'}(3,-1){B'}
\pstInterLL{A}{B}{B'}{A'}{O}
\pstLineAB{A}{B}
\pstLineAB{A'}{B'}
\end{pspicture}

\end{document}


If you don't want the ends of the line segments to stretch beyond the points, remove nodesep = -0.5.

• @SvendTveskaeg Your answer matches with what I exactly wanted. Jan 28, 2015 at 16:29

Here is a reproduction of Sigur's nice graph, using MetaPost (inside a LuaLaTeX program) and some other parameters instead.

The intersection point is very easily obtained with MetaPost, thanks to the very handy whatever macro. I've also made use of the buidcycle and the anglebetween macros (this one comes from the MetaFun format) for the angles and their colouring, and created a macro of my own to draw the "empty" dot where the intersection takes place.

\documentclass{standalone}
\usepackage{unicode-math, xcolor}
\usepackage{luamplib}
\mplibsetformat{metafun}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
vardef drawemptydot (expr z, r) =
save circle; path circle; circle = fullcircle scaled r shifted z;
unfill circle; draw circle ;
enddef;
beginfig(0);
% Settings
u = cm ; % The general unit
pair A, Ap, B, Bp, O ; A = origin ; B = (6, 5)*u ; Ap = (0, 5)*u ; Bp = (6, 0)*u ;
O = whatever[A, B] = whatever[Ap, Bp] ;
% Fine tuning (angles)
path angle_OAAp ; angle_OAAp = anglebetween(O--A, O--Ap, "") ;
path angle_OBBp ; angle_OBBp = anglebetween(O--B, O--Bp, "") ;
% Fillings and drawings angles
fill buildcycle(O--A, angle_OAAp, O--Ap) withcolor \mpcolor{olive!40} ;
draw angle_OAAp withcolor red ;
fill buildcycle(O--B, angle_OBBp, O--Bp) withcolor \mpcolor{blue!40}  ;
draw angle_OBBp withcolor red ;
% Drawing segments
draw A -- B ; draw = Ap -- Bp ;
% The dots
for P = A, B, Ap, Bp: drawdot P withpen pencircle scaled 3bp ; endfor ;
drawemptydot(O, 3bp) ;
% The labels
label.bot("$O$", O) ; label.lft("$A$", A) ; label.rt("$B$", B) ;
label.rt("$B'$", Bp) ; label.lft("$A'$", Ap) ;
% Bounding box enlarged (prevents labels cropping at the extremities of the graph)
setbounds currentpicture to boundingbox currentpicture enlarged 3bp ;
endfig;
\end{mplibcode}
\end{document}


• This is BRILLIANT! A perfect set up. This helps me enormously. Jan 28, 2015 at 19:08