I'm trying to draw an ellipse that must pass through (0, -1)
, (0, 1)
, (-1, 0)
, (1, 0)
, (1, -1)
and (-1, 1)
. My MWE is below. I know that, I'm missing some math here.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\draw [help lines] (-2, -2) grid (2, 2);
\draw[rotate=45] (0, 0) ellipse (0.5cm and 1.5cm);
\filldraw[black] (0, 0) circle(1.5pt);
\filldraw[black] (0, 1) circle(1.5pt);
\filldraw[black] (1, 0) circle(1.5pt);
\filldraw[black] (-1, 0) circle(1.5pt);
\filldraw[black] (0, -1) circle(1.5pt);
\filldraw[black] (1, -1) circle(1.5pt);
\filldraw[black] (-1, 1) circle(1.5pt);
\draw[<->] (-2.0, 0) -- (2.0, 0) node[right]{\footnotesize $X_{1}$};
\draw[<->] (0, -1.5) -- (0, 1.5) node[above]{\footnotesize $X_{2}$};
\node[above right] at (0, 1) {\tiny $\left(0, 1\right)$};
\node[above right] at (1, 0) {\tiny $\left(1, 0\right)$};
\node[above left] at (-1, 0) {\tiny $\left(-1, 0\right)$};
\node[below right] at (0, -1) {\tiny $\left(0, -1\right)$};
\node[below right] at (1, -1) {\tiny $\left(1, -1\right)$};
\node[above left] at (-1, 1) {\tiny $\left(-1, 1\right)$};
\end{tikzpicture}
\end{document}
Edit
The equation of the ellipse is $X_1^2 + X_1 X_2 + X_2^2 = 1$.
Best Answer
Output
You can manually perform the computations as suggested by JoeDub. You can then change
into
Code
You can also do this without rotation by specifying your major axis and minor axis (first axis and second axis in the manual) through the use of the
\pgfpathellipse
command. Here it is with your MWE.Note here that the length of the semi-minor axis is approximately the square root of
0.58^2 + 0.58^2
.Edit
I have used
\foreach
in the above codes to make them shorter.