TikZ-PGF – Graphing with Coordinates and Compass Construction Simultaneously

tikz-pgf

I want to show that there are 6 points on a given ellipse such that any of which with the 2 foci form a isosceles triangle. My code is as following:

    \begin{tikzpicture}[>=latex,scale=.9]
    \begin{axis}[
            axis x line=center,
            axis y line=center,
            ticks=none,
            xlabel={$x$},
            ylabel={$y$},
            xlabel style={right},
            ylabel style={above},
            axis equal,
            xmin=-3.5,
            xmax=3.5,
            ymin=-4.5,
            ymax=4.5
            ]
        \draw [name path=ellipse, thick] (0,0) ellipse (3 and 4);
        \coordinate (C_1) at (0,{sqrt(7)});
        \coordinate (C_2) at (0,{-sqrt(7)});
        \coordinate (P_1) at (2.61829,1.95256);
        \coordinate (P_2) at (-2.61829,1.95256);
        \coordinate (P_3) at (-2.61829,-1.95256);
        \coordinate (P_4) at (2.61829,-1.95256);
        \coordinate (P_5) at (3,0);
        \coordinate (P_6) at (-3,0);

        \draw ({3*cos(deg(pi/3))},{4*sin(deg(pi/3))}) circle (2pt) node [above right] {$P$};
        \draw[thick, dashed] (0,{-sqrt(7)}) arc (270:300:{2*sqrt(7)});
        \draw[thick, dashed] (0,{-sqrt(7)}) arc (270:240:5.2915);
        \draw[thick, dashed] (0,{sqrt(7)}) arc (90:60:5.2915);
        \draw[thick, dashed] (0,{sqrt(7)}) arc (90:120:5.2915);

        \fill [gray] (P_5) -- (C_1) -- (C_2);
        \fill [gray] (P_2) -- (C_1) -- (C_2);
        \draw [thick, dotted] (P_1) -- (C_1) -- (P_3) -- (C_2) -- cycle;
        \draw [thick, dotted] (P_6) -- (C_1) -- (P_4) -- (C_2) -- cycle;
        \draw [thick] (P_5) -- (C_1) -- (P_2) -- (C_2) -- cycle;
        \draw [thick] (C_1) -- (C_2);
        
        \fill (C_1) circle (2pt) node [above] {$C_1$};
        \fill (C_2) circle (2pt) node [below] {$C_2$};
        \fill (P_1) circle (2pt) node [above right] {$P_1$};
        \fill (P_2) circle (2pt) node [above left] {$P_2$};
        \fill (P_3) circle (2pt) node [below left] {$P_3$};
        \fill (P_4) circle (2pt) node [below right] {$P_4$};
        \fill (P_5) circle (2pt) node [right] {$P_5$};
        \fill (P_6) circle (2pt) node [left] {$P_6$};
    \end{axis}
    \end{tikzpicture}

The result is like this: enter image description here

I have several problems or questions:

(1) I want to draw the axes or use the coordinates in a convenient way, so I use the axis environment. This is the first time I try this environment. But I found that some shapes in this environment would become deformed. So I add axis equal instruction in the line. But thereafter I found that I could not change the length of the axes. In my graph, since the ellipse is thinner in x-axis, I set xmin=-3.5, xmax=3.5, ymin=-4.5, ymax=4.5. But the result seems no differnce in the lengths of the axes.

(2) When I set the coordinates of the foci, first I code it as \coordinate (C_1) at (0,2.64575);, where 2.64575 is an approximation of $\sqrt{7}$. But each time when I use a fraction or square root, if I always need to make them into digits, it's too cumbersome. So I tried several times and I found that {sqrt(7)} just worked! I wonder in what circumstances this method can do? For example, when I want to draw a circle with radis 2.64575mm, I code it as \draw (C_1) circle ({sqrt(7)}mm);. It just didn't work. So, is there any materials or manuals that explains in what circumstances Latex provides such "operation fucntion" just to converting fractions, roots, or triangle function forms into digital values. Or I can use Latex as a computer to calculate any value I need? I found that there is a Tikz Library named calc can do something like this. But it seems there's a lot more circumstances we can do things in this way.

(3) When I draw the point $P_1$, I tried to use a circle centered at $C_2$ with radius $\sqrt{7}$, or passing through $C_1$, to intersect the ellipse to get $P_1$. But it didn't work. So finally I calculated the coordinates of the points. I used tkz-euclide serveral times. Its straightedge-compass construction way is somehow intuitive for the users. So I wonder if there any tools we can use here? Whenever we want it in an algebraic way or in a geometric way, it can support us smoothly. I tried Geogebra and converted the result into Latex code. But I don't know if this can just be done directly in Latex.

(4) I edit my Latex document with the online Latex, Overleaf. I don't know if that would make any differnce to the codes.

Thanks a lot for any reply. It's my first time to ask questions here and I tried to express clearly. If there's anything vague I will complement. Thank you.

Best Answer

enter image description here

Some comments

  • I think that "less is better", so I didn't make use of the axis environment.
  • I construct the points (except for P_5 and P_6) as intersection points; it is closer to the title of your question straightedge and compaass constructions. You need to load the library intersections.
  • The two circles are introduced as path commands. You should erase the option draw in case you don't want them in the final figure.

The code

\documentclass[margin=.3cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math, intersections}

\begin{document}


\begin{tikzpicture}[every node/.style={scale=.8}]
  %% the axes
  \draw[gray, ->, thin] (-5, 0) -- (5, 0) node[right] {$x$};
  \draw[gray, ->, thin, name path=y-axis]  (0, -5) -- (0, 5) node[above] {$y$};

  %%
  \path (-3, 0) coordinate (P_6);
  \path (3, 0) coordinate (P_5);
  
  %% ellipse
  \draw[name path=ellipse] (0, 0) ellipse[x radius=3, y radius=4];

  %% circle defining the foci and the foci as intersections
  \path[draw, red, very thin, name path=f-circle] (P_5) circle (4);
  \path[name intersections={of=f-circle and y-axis, by={F_1, F_2}}];

  %% circle defining P_1 and P_2 and these points as intersections
  \path[draw, red, very thin, name path=p-circle]
  let
  \p1 = ($(F_1) - (F_2)$),
  \n1 = {veclen(\x1, \y1)}
  in (F_2) circle (\n1);
  \path[name intersections={of=p-circle and ellipse, by={P_1, P_2}}];
  
  %% one of the triangles
  \draw[fill=blue, opacity=.2] (F_2) -- (P_1) -- (P_2) -- cycle;

  %% show the points
  \foreach \P/\pos in {P_1/above right, P_2/above left,
    P_5/below right, P_6/below left,
    F_1/above left, F_2/below left}{%
    \filldraw[blue] (\P) circle (1.5pt) node[\pos] {$\P$};
  }
\end{tikzpicture}

\end{document}
Related Question