2

I read at here How to draw an ellipse?. If the equation of ellipse is x^2/25+y^2/144=1, I tried

\documentclass[border=2]{standalone}
\usepackage{tikz}
\begin{document}
\newcommand{\boundellipse}[3]% center, xdim, ydim
{(#1) ellipse (#2 and #3)
}

\begin{tikzpicture}
\draw \boundellipse{0,0}{5}{12};
\end{tikzpicture}
\end{document}

I can not use the above code to draw the ellipse with four vertices \left (-\dfrac{52}{5},-\dfrac{39}{5}\right ), \left (\dfrac{52}{5},\dfrac{39}{5}\right ), \left (-\dfrac{36}{5},\dfrac{48}{5}\right ), \left (\dfrac{36}{5},-\dfrac{48}{5}\right ). Semi-major-length of ellipse is 12 and semi-minor-length is 5.

How can I draw that ellipse.

  • I tried your code and it works fine for me. What is the error you are getting? – schtandard Mar 25 '18 at 16:06
  • 2
    Sorry, but I think that your problem is not a TikZ problem. You should probably learn some math : the big radius is sqrt((52/5)**2+(39/5)**2) = 13 and the small one is sqrt((36/5)**2+(48/5)**2) = 12 and the main axis is rotated at 45°. So you have to do \fill[red,rotate=45] (0,0) ellipse (13 and 12);. – Kpym Mar 25 '18 at 16:17
  • please show minimal document where your drawing of vertices fail. from your description is not very clear what you like to achieve. – Zarko Mar 25 '18 at 16:23
  • 1
    The nodes do not sit on your ellipse, you can check this with \node at ({52/5},{39/5}){$\left(\dfrac{52}{5},\dfrac{39}{5}\right )$};. Is this really where you want to place these nodes? – user121799 Mar 25 '18 at 16:25
  • @Kpym Thank you for your Comment. But, the angle does not 45. – minhthien_2016 Mar 26 '18 at 3:17
1

this is rather extended comment ...

  • this site is dedicated to tex problems
  • as i can conclude you like to solve problem how to draw ellipse through four (arbitrary) vertices. this is math problem and is off-topic here

illustration how i understood your question:

enter image description here

mwe for above image:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{nccmath}

\begin{document}
    \begin{tikzpicture}[scale=0.5,% for scaling coordinates of vertices
E/.style args = {#1/#2}{ellipse, draw,
                 minimum width=#1cm, % major length
                 minimum height=#2cm,% minor length
                 inner sep=0pt},
   dot/.style = {circle, fill}
                    ]
\node[E=24/10, rotate=0] {};
\node (a) [dot,
    pin=225: {$\left(-\mfrac{52}{5},-\mfrac{39}{5}\right)$}] at (-52/5,-39/5) {};
\node (b) [dot,
    pin= 45: {$\left( \mfrac{52}{5}, \mfrac{39}{5}\right)$}] at ( 52/5, 39/5) {};
\node (c) [dot,
    pin=135: {$\left(-\mfrac{36}{5},-\mfrac{48}{5}\right)$}] at (-36/5, 48/5) {};
\node (d) [dot,
    pin=315: {$\left( \mfrac{36}{5},-\mfrac{48}{5}\right)$}] at ( 36/5,-48/5) {};
%
\draw[red, dashed] (a) -- (d) -- (b) -- (c) -- (a);
% elipse 1
\node[E=24/10] {};  % <major length>/<minor length>
% elpise 2
\node[E=24/10, rotate=-9, dashed] {};
\end{tikzpicture}
\end{document}

when you have correct determined coordinates of vertices and calculated ellipse rotation angle (if needed), than you ask, how to draw such ellipse. basic idea, how can be ellipse drawn, is shown in above mwe.

  • @Zaeko Perhalp, I have to use a rotation to rotate the ellipse x^2/25+y^2/144=1. Now I am finding the angle of rotation. – minhthien_2016 Mar 26 '18 at 3:19
  • if this solve your problem, then fine (but i doubt in this, coordinates of vertices, which are in pair reflex symmetric should be corners of square). what is now a question? – Zarko Mar 26 '18 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.