# TikZ: constructing a piece of a hyperbola with a given asymptote

\documentclass[convert = false, border = 1cm, tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0, 0) circle[radius = .35cm];
\draw (-60:1.5cm) -- +(0, 4);
\draw (0, 0) -- (-60:1.5cm);
\filldraw[black] (-60:.35cm) circle[radius = .04cm] node[below, font =
\scriptsize] {P};
\draw (-60:1.5cm) -- ++(150:4cm);
\end{tikzpicture}
\end{document}


How can I construct a hyperbola that has the given asymptotes and goes through point P?

What we know is that the turn angle is 120 degrees, the distance from P to the intersection of the lines is 1.5cm which is the semi-major axis, and the radius at periapsis is .35cm.

-

## 1 Answer

I find it easier to draw and then rotate everything by the appropriate angle.

Edit: If you want the origin of the coordinate system to coincide with the centre of the circle, simply translate the scope as shown in my code below (the shift is applied before the rotate).

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\def\angle{60}
\def\circradius{.35}
\def\a{1.5}
\def\asymlen{4}
\begin{scope}[rotate={\angle/2},shift={(0,{-\a-\circradius})}]
\draw (0,0) -- (0, {\a+\circradius}) circle[radius = \circradius];
\draw ({90-\angle/2}:0) -- ({90-\angle/2}:\asymlen);
\draw ({90+\angle/2}:0) -- ({90+\angle/2}:\asymlen);
\filldraw[black] (0,\a)
circle[radius = .04cm] node[right, font =\scriptsize] {P};
\def\myangle{60}
\pgfmathsetmacro\b{\a/tan(\myangle)}
\draw plot[domain=-2:2,samples=100] ({\x},{\a*sqrt(1+(\x/\b)^2)});
\end{scope}
\fill[red] (0,0) circle[radius = .1cm]; % CS origin
\end{tikzpicture}
\end{document}

-