3

this is my code,

\begin{tikzpicture}

\node (A) at (-4, -3) {A};

\node (o) at (0, 0) {o};

\draw [name path = circle] (o) circle (3.5cm); 

\end{tikzpicture}

Given a point A outside a circle, I want to:

  1. draw a tangent line to the circle which come through point A.

  2. find the intersection point (between the tangent line and the circle) and denoted this point as B. (I need to use this point to connect to another point later).

    Is there a way to do it? Thanks. :)

Torbjørn T.
  • 206,688

2 Answers2

5

UPDATE: OK, sorry for misreading your question. I guess I then agree with @Zarko, this is almost identical to the example from the pgfmanual.

\documentclass[tikz,border=3.14pt]{standalone}
\usetikzlibrary{intersections,calc}
\begin{document}
\begin{tikzpicture}

\node (A) at (-4, -3) {A};

\node (o) at (0, 0) {o};

\node [circle,draw,name path=circle] (c) at (o) [minimum size=7cm] {};


\draw[red] (A)  -- (tangent cs:node=c,point={(A)},solution=1) 
coordinate[label=below:B] (B)
       (A) -- (tangent cs:node=c,point={(A)},solution=2)
       coordinate[label=left:C] (C);
\end{tikzpicture}
\end{document}

enter image description here

\documentclass[tikz,border=3.14pt]{standalone}
\usetikzlibrary{intersections,calc}
\begin{document}
\begin{tikzpicture}

\node (A) at (-4, -3) {A};

\node (o) at (0, 0) {o};

\draw[name path=circle] (o) circle (3.5cm); 
\draw[name path=Ao] (A) to[bend left=0](o);
\path [name intersections={of=Ao and circle,total=\t}]
coordinate[label=below:B] (B) at (intersection-1);
\draw ($ (B)!3cm!90:(A) $) -- ($ (B)!3cm!270:(A) $);
\end{tikzpicture}
\end{document}

enter image description here

  • Thank you, it should not looks like this, it means the tangent line come through A, not perpendicular to OA. (I do not know how to add a picture yet, the correct result should looks like this, by connecting OBA, it would form a right triangular. :) – Yikun Bai Apr 12 '18 at 22:34
  • In the first diagram, OBA does form a right triangle. The radius is always perpendicular to a tangent. – John Kormylo Apr 13 '18 at 01:53
  • Hi John Kormylo! I agree. Probably it will become clearer if you address your comment to @Labibi –  Apr 13 '18 at 02:04
2

Here is a way to do the same construction with pst-eucl:

\documentclass[11pt, svgnames, border = 5pt]{standalone}
\usepackage{pstricks-add} % loads also pst-node
\usepackage{pst-eucl} % for plane geometry

% \usepackage{auto-pst-pdf} % to compile with pdflatex --enable-write18 (MiKTeX) or pdflatex --shell-escape (TX Live, MacTeX))

\begin{document}

\begin{pspicture}(-6,-5)(4,4)
\psset{PointSymbol=none, dotsize=2.5pt, linejoin=1, dimen=outer, unit=1cm}
\pstGeonode[PosAngle={30,-150}](0, 0){O}(-4,-3){A}
\pstCircleOA[Radius =\pstDistVal{3.5}, linecolor = IndianRed, linewidth = 1.2pt]{O}{}
\pstMiddleAB[ PointName=none]{O}{A}{I}
 \psset{linewidth=0.6pt}
 \pstInterCC[RadiusA=\pstDistVal{3.5}, DiameterB=\pstDistAB{O}{A},
 CodeFigB=true, CodeFigColor=Gold, PointName=default]{O}{}{I}{}{C}{B}
 \uput[l](B){B} \uput[d](C){C}
 \psset{linecolor=Tomato, nodesep=-2}
 \pstLineAB{A}{B}\pstLineAB{A}{C}
 \psline[linestyle=dashed](B)(O)(C)
 \psset{linecolor = LightSteelBlue, linewidth=0.4pt, RightAngleSize=0.15}
 \pstRightAngle*{A}{B}{O}
 \pstRightAngle{A}{C}{O}
\end{pspicture}

\end{document}

enter image description here

Bernard
  • 271,350