# How to draw with Tikz a chord parallel to AC that passes through a point?

I've drawn the following diagram with Tikz:

The code used:

\documentclass{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{babel,calc,arrows,shapes.geometric,intersections,through,backgrounds}

\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45, x=5.0cm, y=5.0cm]
% point O
\coordinate (O) at (0,0);
% ABC triangle
\node[name = t, name path = tri, regular polygon, regular polygon sides=3, minimum size=4.5cm, fill=lightgray!50, draw] at (O) {};
\coordinate [label=above:$A$] (A) at (t.corner 1);
\coordinate [label=left:$B$]  (B) at (t.corner 2);
\coordinate [label=right:$C$] (C) at (t.corner 3);
% O's label
\node [above left] at (O) {$O$};
% circle with 2.25cm radius and centre at O
\draw (O) circle (2.25cm);
% point D: the point in the circumference whose angle is 50° with OC
\coordinate [label=above right:$D$] (D) at ($(O)!1!50:(C)$);
\draw [name path=OD] (O) -- (D);
% point E: intersection between radius OD and the triangle
\path [name intersections={of=OD and tri,by=E}];
\node [below] at (E) {$E$};
% point F: point 33% the way from O to E
\coordinate [label=above:$F$] (F) at ($(O)!.33!(E)$);
% draw bullets at each point
\foreach \point in {A,B,C,O,D,E,F}
\fill [black] (\point) circle (1.5pt);
\end{tikzpicture}
\end{document}


About my current code:

• I'm aware of tkz-euclide and I think it could help me here, but the only documentation I could find (at CTAN) is in French, a language I can't read.
• According to the pgf documentation, the arrows library has been deprecated in favor of arrows.meta. I only used arrows because this code was adapted from Geogebra and I still haven't got into changing that particular aspect of the code.

I want to place 2 points G and H in the circle such that the chord GH:

• passes through F and
• is parallel to AC

so as to obtain something like this (the following was drawn with Geogebra):

I've found answers regarding drawing parallel lines, but in this case it's not just parallel, it also needs to start and end at the circle, so I couldn't find a good answer by myself.

Define an (overlay such that it does not increase the bounding box) path that has the same slope as A--C (this is what let \p1=($(C)-(A)$),\n1={atan2(\y1,\x1)} in does, which computes the angle of the line) and runs through F, and compute its intersections with the circle.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows,calc,shapes.geometric,intersections}
\begin{document}
\begin{tikzpicture}[line cap = round, line join = round, >=triangle 45, x=5.0cm, y=5.0cm]
% point O
\coordinate (O) at (0,0);
% ABC triangle
\node[name = t, name path = tri, regular polygon, regular polygon sides=3, minimum size=4.5cm, fill=lightgray!50, draw] at (O) {};
\coordinate [label=above:$A$] (A) at (t.corner 1);
\coordinate [label=left:$B$]  (B) at (t.corner 2);
\coordinate [label=right:$C$] (C) at (t.corner 3);
% O's label
\node [above left] at (O) {$O$};
% circle with 2.25cm radius and centre at O
\draw[name path=circle] (O) circle (2.25cm);
% point D: the point in the circumference whose angle is 50° with OC
\coordinate [label=above right:$D$] (D) at ($(O)!1!50:(C)$);
\draw [name path=OD] (O) -- (D);
% point E: intersection between radius OD and the triangle
\path [name intersections={of=OD and tri,by=E}];
\node [below] at (E) {$E$};
% point F: point 33% the way from O to E
\coordinate [label=above:$F$] (F) at ($(O)!.33!(E)$);
\path[overlay,name path=line] let \p1=($(C)-(A)$),\n1={atan2(\y1,\x1)} in % computes the slope of A--C
($(F)+(\n1:2*2.25cm)$) -- ($(F)+(180+\n1:2*2.25cm)$);
\draw[name intersections={of=line and circle,by={G,H}}] (G) node[above left]{$G$}
-- (H) node[below right]{$H$};
% draw bullets at each point
\foreach \point in {A,...,H}
\fill [black] (\point) circle (1.5pt);
\end{tikzpicture}
\end{document}


Alternatively you may just "parallel transport" the A--C path, which produces the same result and involves no atan2.

 \path[overlay,name path=line]
($(F)+($(C)-(A)$)$) -- ($(F)+($(A)-(C)$)$);

• thanks a lot! is there by any chance some place that summarizes the job of let and \p? I've read about them in the documentation, couldn't understand their purpose and then skipped them. Now that I see they were needed for my problem, I think it's best to stop avoiding them. – Daniel Diniz May 18 at 22:04
• @DanielDiniz let \p1=($(C)-(A)$) stores the vector A--C in \p1, after that \x1 will be the x-component of that vector, and \y1 its y-component. Then \n1={atan2(\y1,\x1)} computes the arctan of \y1/\x1, i.e. the angle of the slope. (atan2 also has the information on the quadrant, which is in this very case not needed, but in general good to have.) I also added an alternative that does not make use of the let ... in construction. – marmot May 18 at 23:56

Just for completeness sake. You mentioned tkz-euclide and I as well does not speak a single word french. However the documentation is easy to use if you just search after keywords such as "midpoint", "parallel" and so forth. In addition the following cheatsheet with commands from tkz-euclide is very helpfull

tkz-euclid-cheatsheet.en.md

To answer your question on how to define a line through F parallel with AC this is as simple as

\tkzDefLine[parallel=through F](A,C) \tkzGetPoint{f}


in tkz-euclide. Given that the points are already defined. Similarly finding the intersections with the circle can be done via

\tkzInterLC(F,f)(O,A) \tkzGetPoints{G}{H}


Where tkzInterLC can be read as intersection between the line Ff and the circle with center O and radius r = |OA|.

See below for the full code =)

\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all} % on charge tous les objets

\usepackage[utf8]{inputenc}

\begin{document}

\begin{tikzpicture}
\tkzInit[xmin=-0.5,xmax=4.5,ymin=-1.4,ymax=4]
\tkzClip
% Defines where F is placed on the segment OE.
% 0 = O and 1 = E
\edef\OF{0.5}

\tkzDefPoint(0,0){B} \tkzDefPoint(4,0){C}

\tkzDefEquilateral(B,C)\tkzGetPoint{A};
\tkzDefBarycentricPoint(A=1,B=1,C=1) \tkzGetPoint{O}
\tkzDefMidPoint(A,C) \tkzGetPoint{E}

% Finds the intersection between the line OE and the
% circle with center O, and radius r = |OA|.
\tkzInterLC(O,E)(O,A) \tkzGetPoints{D2}{D}

% Calculates the length |OE| multiplies it with scaling
\tkzCalcLength[cm](O,E)\tkzGetLength{rOE}
\pgfmathsetmacro{\pointF}{\OF*\rOE}

\tkzInterLC[R](O,D)(O,\pointF cm) \tkzGetPoints{F2}{F}

% Calculates the line parallell to AC through F
\tkzDefLine[parallel=through F](A,C) \tkzGetPoint{f}
\tkzInterLC(F,f)(O,A) \tkzGetPoints{G}{H}

\tkzDrawPolygon[fill=black!10](A,B,C)
\tkzDrawSegments(G,H O,D)
\tkzDrawPoints[fill=black,size=10](A,B,C,O,E,D,F,G,H)
\tkzDrawCircle(O,A)

\tkzLabelPoint[above](A){$A$}
\tkzLabelPoint[below left](B){$B$}
\tkzLabelPoint[below right](C){$C$}
\tkzLabelPoint[right](D){$D$}
\tkzLabelPoints[above](E,F,O)

\tkzLabelPoint[above left](G){$G$}
\tkzLabelPoint[below](H){$H$}
\end{tikzpicture}

\end{document}


A PSTricks solution only for fun purposes.

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\pstTriangle[fillcolor=lightgray,fillstyle=solid](4;90){A}(4;-150){B}(4;-30){C}
\pstTriangleOC{A}{B}{C}
\pstGeonode(0,0){O}(4;30){D}
\pstInterLL{A}{C}{O}{D}{E}
\pstOIJGeonode[PointName={default,none},PointSymbol={*,none}]
(-.5,0){F}{E}{D}{A}(-.5,1){T}
\pstInterLC[PosAngleA=-45,PosAngleB=135]{F}{T}{O}{D}{H}{G}
\psline(O)(D)
\psline(G)(H)
\end{pspicture}
\end{document}