# intersection of line and circle [duplicate]

I want to define the point X dynamically. Now I have defined the point at -90° but I want to make it changeable depending on the place of O. (I know there are similar questions, but I don't find the answer on my problem.)

 \documentclass{article}
\usepackage{pgfplots}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (O) at (canvas polar cs:angle=90,radius=3cm) ;
\coordinate (A) at (canvas polar cs:angle=-130,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=-30,radius=3cm) ;
\coordinate (X) at (canvas polar cs:angle=-90,radius=3cm);
\draw (M) circle (3cm);
\draw (A) -- (M) -- (B);
\draw (A) -- (O) -- (B);
\tkzDrawPoints(O,A,B,M,X);
\tkzLabelPoints[left](A,M);
\tkzLabelPoints[below right](X);
\tkzLabelPoints[above left](O);
\tkzLabelPoints(B);
\tkzMarkAngle[fill= red,size=1.5cm, opacity=.4](A,M,B);
\tkzMarkAngle[fill= red,size=1.5cm, opacity=.4](A,O,B);
\tkzLabelAngle[pos = 1.2](A,O,M){$2$};
\tkzLabelAngle[pos = 1.2](M,O,B){$1$};
\tkzLabelAngle[pos = 1.1](A,M,X){$2$};
\tkzLabelAngle[pos = 1.1](X,M,B){$1$};
\end{tikzpicture}
\end{center}
\end{document}


## marked as duplicate by jubobs, Qrrbrbirlbel, Thorsten, Heiko Oberdiek, egregAug 24 '13 at 16:34

It's not clear from the question, how X shall be defined, but I guess you want the point opposite of O on the circle line. In that case, it's easiest, if you simply reflect O at M to get X:

 \documentclass{article}
\usepackage{pgfplots}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (O) at (canvas polar cs:angle=110,radius=3cm) ;
\coordinate (A) at (canvas polar cs:angle=-130,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=-30,radius=3cm) ;
% \coordinate (X) at (canvas polar cs:angle=-90,radius=3cm);
\tkzDefPointBy[symmetry=center M](O)\tkzGetPoint{X}
\draw (M) circle (3cm);
\draw (A) -- (M) -- (B);
\draw (A) -- (O) -- (B);
\tkzDrawPoints(O,A,B,M,X);
\tkzLabelPoints[left](A,M);
\tkzLabelPoints[below right](X);
\tkzLabelPoints[above left](O);
\tkzLabelPoints(B);
\tkzMarkAngle[fill= red,size=1.5cm, opacity=.4](A,M,B);
\tkzMarkAngle[fill= red,size=1.5cm, opacity=.4](A,O,B);
\tkzLabelAngle[pos = 1.2](A,O,M){$2$};
\tkzLabelAngle[pos = 1.2](M,O,B){$1$};
\tkzLabelAngle[pos = 1.1](A,M,X){$2$};
\tkzLabelAngle[pos = 1.1](X,M,B){$1$};
\end{tikzpicture}
\end{center}
\end{document}


Of course, you might indeed want the second intersection of OM and the circle, which is a different point iff O is not on the circle line. In that case replace the definition of X by

\tkzInterLC(O,M)(M,A)\tkzGetPoints{notinteresting}{X}

• TikZ solutions include \coordinate (X) at ([rotate around=180:(M)] O); and \coordinate (X) at ($(M)!-1!(O)$); – Qrrbrbirlbel Aug 24 '13 at 15:49
• Or \coordinate (X) at ($2*(M)-(O)$);. – Toscho Aug 24 '13 at 15:55