# Tikz graphying with coordinates and straightedge and compass construction at the same time?

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:

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.

• 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

%% 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}

– 游逸翔
Commented May 25, 2022 at 10:43
• Hi! Don't forget, if you are happy with the answer, to confirm it. Commented May 25, 2022 at 14:57
• @Dainel N, sorry do you mean click the upward arrow on the left side of this answer to confirm that "This answer is useful"? But the forum message says I need at least 15 reputation to cast a vote.
– 游逸翔
Commented May 29, 2022 at 4:27
• Hi! To accept an answer "click on the check mark". You have that right since you asked the question. See stats.stackexchange.com/help/someone-answers . Commented May 29, 2022 at 5:38

tkz-euclide doesn't know how to draw ellipses and especially it is difficult to use name path. For the drawing of ellipses and more complicated intersections, I'm waiting to be able to introduce lua for all calculations. In the meantime, using Daniel N's code, here is what you can get by combining tkz-euclide and TikZ.

\documentclass[margin=.3cm]{standalone}
\usepackage{tkz-euclide}
\begin{document}

\begin{tikzpicture}
\tkzInit[xmin=-5,ymin=-5,xmax=5,ymax=5]
\tkzDrawX\tkzDrawY
\tkzDefPoints{-3/0/A,3/0/B,-1/0/x,1/0/I,0/1/J,0/0/O}
\tkzInterLC(O,J)(B,x)    \tkzGetPoints{F_1}{F_2}
\tkzCalcLength(F_1,F_2). \tkzGetLength{rc}
\path[name path=p-circle](F_2) circle (\rc);
\path[name intersections={of=p-circle and ellipse, by={P_1, P_2}}];
\tkzDrawPolygon(P_1,P_2,F_2)
\tkzFillPolygon[blue, opacity=.2](P_1,P_2,F_2)
\tkzDrawPoints(P_1,P_2,F_1,F_2,A,B)
\tkzAutoLabelPoints[center=O,dist=.05,above right](P_1,F_1,F_2,B)
\tkzAutoLabelPoints[center=O,dist=.05,above left](P_2,A)
\end{tikzpicture}

\end{document}


• I tried this code but it didn't work. I don't know what the problem was. But I still can learn from it. Thank you.
– 游逸翔
Commented May 25, 2022 at 11:08