2

I would like to draw the following picture in tikz

enter image description here

All arcs are part of circles. I would like to specify the following information only : the coordinates of the points a and b, varying radii for the different circle portions, and fractions or percentages t to place purple and pink points along the circles at a specified fraction of the way between two previously defined points.

So for instance I would like to say that the big purple points on the right arc are 60% and 80% along the way from a to b, while the big purple points on the left arc are 40% and 70% along the way from a to b, while the pink points are midway on some circular arc joining pairs of previously defined big purple points.

If I could place some pink circles "harmoniously" in the center of the curved triangles ...


My main problem is the following : suppose I have two points a and b (given by cartesian coordinates) and a radius \rad : this specifies two circles passing through these points of given radius. How do I place a point on one of these circles that is t % along the way from a to b ?

An equivalent problem is the following : suppose I have a center point centerab and two points a and b, whose coordinates are expressed in cartesian coordinates : how do I find their polar coordinates relative to the point centerab ?

Do I have to use linear algebra (such matrix rotation, but also finding angles using arcsin), or can tikz provide me with a simple solution ?


The code below only finds the centers of such circles, but I don't know how to find the polar coordinates of a and b relative to this center, or how to place a point t percent along the way from a to b.

\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}

\begin{document}

\begin{center}
\begin{tikzpicture}
\def\rad{8};
\coordinate (b) at (5,8);
\coordinate (a) at (0,0);
\draw [fill=green] (a) circle (2pt);
\draw [fill=green] (b) circle (2pt);
\path [name path = acirc] (a) circle (\rad);
\path [name path = bcirc] (b) circle (\rad);
\path [name intersections={of=acirc and bcirc}];
\coordinate (centerab) at (intersection-1);
\draw (centerab) circle (2pt);
\draw (centerab) circle (\rad);
\end{tikzpicture}
\end{center}

\end{document}
3
  • 1
    Maybe helpful package \usepackage{tkz-euclide}.
    – Bobyandbob
    Commented May 2, 2017 at 18:50
  • The center of the circle is located on the perpendicular bisector to $\overbar{ab}$, or simply use the intersections tikzlibrary for the intersections of circles (paths only) of radius \rad centered at a and b. Use the [pos=.5] (for example) option for coordinates along a path. @Bobyandbob - Have they translated the tks-euclide manual into anything besides french yet? Commented May 2, 2017 at 20:14
  • @JohnKormylo . No, i only know the french version.
    – Bobyandbob
    Commented May 2, 2017 at 20:17

1 Answer 1

2

I think this is called bipolar coordinates.

Here is a naïve implementation

\documentclass[border=9,tikz]{standalone}

\begin{document}

\makeatletter
\tikzset{
    cs/.cd,
    F1/.store in=\tikz@cs@Fone,
    F1={-1,0},
    F2/.store in=\tikz@cs@Ftwo,
    F2={1,0},
    sigma/.store in=\tikz@cs@sigma,
    sigma=180,
    s/.store in=\tikz@cs@sigma,
    tau/.store in=\tikz@cs@tau,
    tau=0,
    t/.store in=\tikz@cs@tau,
}

\tikzdeclarecoordinatesystem{bipolar}
{%
  \tikzset{cs/.cd,#1}%
  \tikz@scan@one@point\pgf@process(\tikz@cs@Fone)\pgfmathsetmacro\Fax{\pgf@x}\pgfmathsetmacro\Fay{\pgf@y}%
  \tikz@scan@one@point\pgf@process(\tikz@cs@Ftwo)\pgfmathsetmacro\Fbx{\pgf@x}\pgfmathsetmacro\Fby{\pgf@y}%
  \pgfmathsetmacro\Fmidx{(\Fax+\Fbx)/2}\pgfmathsetmacro\Fmidy{(\Fay+\Fby)/2}%
  \pgfmathsetmacro\Funitx{(\Fbx-\Fax)/2}\pgfmathsetmacro\Funity{(\Fby-\Fay)/2}%
  \pgfmathsetmacro\compou{(sinh(\tikz@cs@tau))/(cosh(\tikz@cs@tau)-cos(\tikz@cs@sigma))}%
  \pgfmathsetmacro\compov{(sin(\tikz@cs@sigma))/(cosh(\tikz@cs@tau)-cos(\tikz@cs@sigma))}%
  \pgfmathsetlength\pgf@x{\Fmidx+\compou*\Funitx-\compov*\Funity}%
  \pgfmathsetlength\pgf@y{\Fmidy+\compou*\Funity+\compov*\Funitx}%
}


\tikz{
    \fill[green]
        (0,0)circle(.1)coordinate(a)
        (8,3)circle(.1)coordinate(b);
    \draw[purple]foreach\tau in{-2,-1.8,...,2}{
        (bipolar cs:F1=a,F2=b,sigma=90,tau=\tau)circle(.1)
    };
    \draw[cyan]foreach\sigma in{10,20,...,350}{
        (bipolar cs:F1=a,F2=b,sigma=\sigma,tau=1)circle(.1)
    };
}


\end{document}

Here is another example

\tikz{
    \fill[green]
        (0,0)circle(.1)coordinate(a)
        (8,3)circle(.1)coordinate(b);
    \fill[purple]foreach\sigma in{30,40,...,330}{
        foreach\tau in{-2,-1.8,...,2}{
            (bipolar cs:F1=a,F2=b,sigma=\sigma,tau=\tau)circle(.1)
        }
    };
    \draw[->](bipolar cs:F1=a,F2=b,sigma=340,tau=2)->+(1,2)node[above]{$\sigma$};
    \draw[->](bipolar cs:F1=a,F2=b,sigma=340,tau=2)->+(2,-1)node[right]{$\tau$};
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .