%Center, (O), \r, radius of main circle should be predefined.
%\alphap and \alphaq as well: Angles for P and Q respective
%Angle for external point, R
\tikzmath{\alpha=(\alphap+\alphaq)*0.5;};
%Unit length coordinates of P, Q and E
\tikzmath{\px=cos(\alphap);};
\tikzmath{\py=sin(\alphap);};
\tikzmath{\qx=cos(\alphaq);};
\tikzmath{\qy=sin(\alphaq);};
\tikzmath{\ex=cos(\alpha);};
\tikzmath{\ey=sin(\alpha);};
\coordinate (P) at ($(O)+\r*(\px,\py)$);
\coordinate (Q) at ($(O)+\r*(\qx,\qy)$);
\coordinate (NP) at ($(-\py,\px)$);
\coordinate (NQ) at ($(-\qy,\qx)$);
\coordinate (P) at ($(O)+\r*(\px,\py)$);
\tikzmath{\pqx=\r*(\qx-\px);};
\tikzmath{\pqy=\r*(\qy-\py);};
%Length of segment PQ: a=|PQ|
\tikzmath{\a=(\px-\qx)*(\px-\qx)+(\py-\qy)*(\py-\qy);};
\tikzmath{\a=\r*sqrt(\a)/2;};
%Distance of segment PQ from origin
\tikzmath{\b=sqrt(\r*\r-\a*\a);};
%Distance from midpoint of PQ to focal point: c
\tikzmath{\c=(0.5*(\r*\r+\a*\a-\b*\b)/\b;};
\tikzmath{\c=\a*\a/\b;};
%Distance from P or Q Q to focal point: d
\tikzmath{\d=(\a*\a+\c*\c/(\b*\b);};
\tikzmath{\d=sqrt(\d);};
\coordinate (S) at ($(O)+\b*(\ex,\ey)$);
\coordinate (R) at ($(S)+\c*(\ex,\ey)$);
\filldraw[test,]
(S) circle(1pt)
node [anchor=north east]{$S$}
;
\filldraw[test,]
(R) circle(1pt)
node [anchor=south]{$R$}
;
\coordinate (PQ) at (\pqx,\pqy);
\tkzLabelSegment[test,pos=0.5,below](O,P) { $r$};
\tkzLabelSegment[test,pos=0.5,below](O,Q) { $r$};
\tkzLabelSegment[test,pos=0.25,below](P,Q) { $a$};
\tkzLabelSegment[test,pos=0.75,below](P,Q) { $a$};
\tkzLabelSegment[test,pos=0.5,right](O,S) { $b$};
\tkzLabelSegment[test,pos=0.5,right](S,R) { $c$};
\tkzLabelSegment[test,pos=0.5,left](P,R) { $d$};
\tkzLabelSegment[test,pos=0.5,right](Q,R) { $d$};
\tkzMarkRightAngle[test,](O,Q,R);
\tkzMarkRightAngle[test,](O,P,R);
\tkzMarkRightAngle[test,](P,S,R);
\tkzMarkRightAngle[test,](Q,S,R);
%Main circle
\draw [name path=c](O) circle(\r);
\draw [art](P) -- (O) -- (Q);
\draw [test,](O) -- (R);