I hope this helps you with the first two parts of your question.
The calc
library provides the ($(p1)!<magic>!(p2)$)
syntax that evaluates to various coordinates.
If <magic>
is a ratio (say, .1
, .5
or even -.1
) the resulting coordinate lies between (p1)
(ratio = 0
) and (p2)
(ratio = 1
). If <magic>
is a coordinate (like (F)
), this coordinate is projected orthogonal onto the line between (p1)
and (p2)
(in the example below, the resulting circles a gray).
The very small library through
provides only one option: circle through
. This option accepts one coordinate through which the circle (this is a node of the shape circle
) goes.
The option circle through extra radius
which is to be used after circle through
adds its argument to the circle’s radius.
The coordinate which will produce equal-radius circles will be saved under the name (half-center)
, the coordinate where (F)
is projected onto the line will be stored unter the name (F-center)
(please use better names in your project ;)
). One could also use calc’s ($<stuff>$)
syntax for circle through
but this way, we can reference these coordinates later without the need to let TikZ re-calculate the coordinate over and over again (and it is easier to maintain).
The—apparently un-documented—intersection cs
can be used to find the intersection of line/line, lines/circle and circle/circle. This works only if the circle is a node!
There is also the intersections
library which can find any intersection between arbitrary paths (refer to Gonzalo Medina’s example, and also TeX.se which has some interesting (and abusing) examples).
Now, I don’t know nothing about this “arc”. If it is a true arc (part of a circle = constant radius) you can take three coordinates (preferable the most outer ones and the center one) and calculate the needed center and start and end angle), but if not, you can add more hidden circles as I did in the example below with {draw=none}/3cm
.
If you want a correct smooth hyperbole, I’mma gonna need some math.
Code
\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{through,calc}
\makeatletter
\tikzset{circle through extra radius/.code={% unorthodox addon for the through library
% needs to be used after 'circle through'!
% this can be avoided by slightly changing the source
\tikz@addoption{%
\pgfmathsetlengthmacro\pgf@tempa{\pgfkeysvalueof{/pgf/minimum width}+2*(#1)}%
\pgfset{/pgf/minimum width/.expanded=\pgf@tempa}%
}%
}}
\tikzset{
special style/.code={%
\if#1\tikz@nonactiveexlmark
\pgfkeysalso{@special style}%
\else
\pgfkeysalso{style/.expanded=#1}%
\fi
},
@special style/.style={draw=none,fill=none}
}
\makeatother
\begin{document}
\begin{tikzpicture}[
every label/.append style={font=\small},
dot/.style={fill,outer sep=+0pt,inner sep=+0pt,minimum size=2pt,shape=circle,draw=none,label={#1}},
dot/.default={}
]
\node[dot={right:\(P_1\)}] (P1) at ( 3, 0) {};
\node[dot={\(P_2\)}] (P2) at (-1.5, 2) {};
\node[dot={below:\(F\)}] (F) at ( 0, 0) {};
\path [blue] (F) edge (P1) edge (P2) (P1) edge (P2);
\draw[dashed,gray] (F) -- ($(P1)!(F)!(P2)$) coordinate (F-center);
\path ($(P1)!.5!(P2)$) coordinate (half-center);
\foreach \sStyle/\xFocus in {{draw=gray}/F,{draw,thick}/half}
\foreach \cPoint in {1,2}
\foreach \sStyleR/\dDeltaRadius[count=\cRadius from 0] in {/0cm,/1cm/,/2cm,!/3cm}
\node[style/.expanded=\sStyle, special style/.expanded={\sStyleR}] at (P\cPoint.center) ({\xFocus:\cPoint:\cRadius}) [circle through/.expanded={(\xFocus-center)},circle through extra radius=\dDeltaRadius] {};
\foreach \cSolution in {1,2}
\foreach \cRadius in {1,...,3}
\coordinate (i-\cRadius-\cSolution) at (intersection cs: first node={F:1:\cRadius}, second node={F:2:\cRadius}, solution=\cSolution);
%
\draw[green] (i-3-1) -- (i-2-1) -- (i-1-1) -- (F-center) -- (i-1-2) -- (i-2-2) -- (i-3-2); % These are straight line segments, but would you have known? ;)
\end{tikzpicture}
\end{document}
Output
Code (with plot
/smooth
)
\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{through,calc}
\makeatletter
\tikzset{circle through extra radius/.code={% unorthodox addon for the through library
% needs to be used after 'circle through'!
% this can be avoided by slightly changing the source
\tikz@addoption{%
\pgfmathsetlengthmacro\pgf@tempa{\pgfkeysvalueof{/pgf/minimum width}+2*(#1)}%
\pgfset{/pgf/minimum width/.expanded=\pgf@tempa}%
}%
}}
\tikzset{
special style/.code={%
\if#1\tikz@nonactiveexlmark
\pgfkeysalso{@special style}%
\else
\pgfkeysalso{style/.expanded=#1}%
\fi
},
@special style/.style={draw=none,fill=none}
}
\makeatother
\begin{document}
\foreach \fRatio in {.05,.1,...,.96}{%
\begin{tikzpicture}[
every label/.append style={font=\small},
dot/.style={fill,outer sep=+0pt,inner sep=+0pt,minimum size=2pt,shape=circle,draw=none,label={##1}},
dot/.default={}
]
\node[dot={right:\(P_1\)}] (P1) at ( 3, 0) {};
\node[dot={\(P_2\)}] (P2) at (-1.5, 2) {};
\node[dot={below:\(F\)}] (F) at ( 0, 0) {};
\path [blue] (F) edge (P1) edge (P2) (P1) edge (P2);
\path ($(P1)!\fRatio!(P2)$) coordinate (half-center);
\foreach \sStyle/\xFocus in {{draw,thick}/half}
\foreach \cPoint in {1,2}
\foreach \sStyleR/\dDeltaRadius[count=\cRadius from 0] in {/0cm,!/.25cm,!/.5cm,!/.75cm,/1cm/,!/1.5cm,/2cm,!/2.5cm,/3cm,!/3.5cm} {
\node[style/.expanded=\sStyle, special style/.expanded={\sStyleR}] at (P\cPoint.center) ({\xFocus:\cPoint:\cRadius}) [circle through/.expanded={(\xFocus-center)},circle through extra radius=\dDeltaRadius] {};
\global\let\cRadius\cRadius
}
\let\maxCircles\cRadius
\edef\maxCirclesMinus{\number\numexpr\maxCircles-1\relax}%
\foreach \cSolution in {1,2}
\foreach \cRadius in {1,...,\maxCircles}
\coordinate (i-\cRadius-\cSolution) at (intersection cs: first node={half:1:\cRadius}, second node={half:2:\cRadius}, solution=\cSolution);
\def\myList{}
\foreach \cRadius in {\maxCircles,\maxCirclesMinus,...,1} {\xdef\myList{\myList(i-\cRadius-1)}}
\edef\myList{\myList(half-center)}
\foreach \cRadius in {1,...,\maxCircles} {\xdef\myList{\myList(i-\cRadius-2)}}
\draw[ultra thick,green,smooth] plot coordinates {\myList};
% for the bounding box:
\path (P1) circle (8cm);
\path (P2) circle (8cm);
\end{tikzpicture}}
\end{document}
A solution which allows to draw intersection segments
of any two intersections is available as tikz library fillbetween
.
This library works as general purpose tikz
library, but it is shipped with pgfplots
and you need to load pgfplots
in order to make it work:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw [name path=red,red] (120:1.06) circle (1.9);
%\draw [name path=yellow,yellow] (0:1.06) circle (2.12);
\draw [name path=green,green!50!black] (0:0.77) circle (2.41);
\draw [name path=blue,blue] (0:0) circle (1.06);
% substitute this temp path by `\path` to make it invisible:
\draw[name path=temp1, intersection segments={of=red and blue,sequence=L1}];
\draw[red,-stealth,ultra thick, intersection segments={of=temp1 and green,sequence=L3}];
\end{tikzpicture}
\end{document}
The key intersection segments
is described in all detail in the pgfplots
reference manual section "5.6.6 Intersection Segment Recombination"; the key idea in this case is to
create a temporary path temp1
which is the first intersection segment of red and blue
, more precisely, it is the first intersection segment in the L
eft argument in red and blue
: red
. This path is drawn as thin black path. Substitute its \draw
statement by \path
to make it invisible.
Compute the desired intersection segment
by intersecting temp1
and green
and use the correct intersection segment. By trial and error I figured that it is the third segment of path temp1
which is written as L3
(L
= left argument in temp1 and green
and 3
means third segment of that path).
The argument involves some trial and error because fillbetween
is unaware of the fact that end and startpoint are connected -- and we as end users do not see start and end point.
Note that you can connect these path segments with other paths. If such an intersection segment
should be the continuation of another path, use --
as before the first argument in sequence. This allows to fill paths segments:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw [name path=red,red] (120:1.06) circle (1.9);
%\draw [name path=yellow,yellow] (0:1.06) circle (2.12);
\draw [name path=green,green!50!black] (0:0.77) circle (2.41);
\draw [name path=blue,blue] (0:0) circle (1.06);
% substitute this temp path by `\path` to make it invisible:
\draw[name path=temp1, intersection segments={of=red and blue,sequence=L1}];
\draw[red,fill=blue,-stealth,ultra thick, intersection segments={of=temp1 and green,sequence=L3}]
[intersection segments={of=temp1 and green, sequence={--R2}}]
;
\end{tikzpicture}
\end{document}
Best Answer
You can also draw that path at one go so you don't need to fill white to restrict the fill if you have something else underneath it. And while you are at it you can also place the labels and coordinates too.