3

Good morning, I'm drawing an ellipse with its conjugate deameters. My MWE

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0:360,no markers]
    \pgfplotsinvokeforeach{-4,-3,-2,-1,0,1,2,3,4}{
      \addplot ({x/360},{#1+x/360});
      \addplot ({#1+x/360},{#1-1.07*x/360});
      \addplot ({5*sin(x)},{4*cos(x)});
         }
  \end{axis}
\end{tikzpicture}

\end{document} 

Questions - how to make straight lines longer enough? How to make an ellipse smoother? Thanks!

  • 1
    for smoother draw of ellipse ad smooth option to tikzpicture or to addplot. Regarding lines, I don't understand what you meaning with "longer". Where they should be (from where to where)? – Zarko Apr 19 '16 at 6:23
  • They should fill an ellipse. Every line has its ends on elipse – Olga K Apr 19 '16 at 6:26
  • Than you have mathematical problem :-) Coordinates for lines are wrong calculated. They should be on ellipse border. Another solution is use intersection library .... see description in the section "13.3.2 Intersections of Arbitrary Paths" on page 136 of recent TikZ manual. There are some examples how to do this. – Zarko Apr 19 '16 at 6:34
  • Give me the link on recent Tikz manual please – Olga K Apr 19 '16 at 6:39
  • Here it is: ctan.mirror.garr.it/mirrors/CTAN/graphics/pgf/base/doc/… (look at section 13.3.2) – Enrico Maria De Angelis Apr 19 '16 at 6:42
5

I don't know what conjugate diameters are, but with an ellipse shaped node and its polar anchors, it's easy to draw lines between any two points on ellipse border.

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

\begin{document}
\begin{tikzpicture}
\node[ellipse, draw, minimum width=3cm, minimum height=2cm] (A) {};

\draw (A.30)--(A.210);
\draw (A.40)--(A.200);
\draw (A.120)--(A.300);
\end{tikzpicture}

\end{document} 

enter image description here

  • my congradulations, now you know about conj diamaters)) And I know about anchors. Probably, your treat is useful. – Olga K Apr 19 '16 at 7:07
1

Ok, due to all recommendations above I arrived to folowing

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[help lines/.style={blue!30,very thin},scale=0.6]
\draw [help lines] (-6, -3) grid (6, 3);
\draw[->] (-6, 0) -- (6, 0) node[below]{\footnotesize $x$};
\draw[->] (0, -3) -- (0, 3) node[right]{\footnotesize $y$};
\draw[color=blue,very thick] (0, 0) ellipse (4cm and 2cm);

\draw[-,green!50!black] (2, -2) -- (5, 1) ; 
\draw[-,green!50!black] (1, -2) -- (4, 1) ;
\draw[-,green!50!black] (0, -2) -- (4, 2);
\draw[-,green!50!black] (-1, -2) -- (3, 2);
\draw[-,green!50!black] (-2, -2) -- (2, 2);

\draw[-,green!50!black] (-5, -1) -- (-2, 2) ;
\draw[-,green!50!black] (-4, -1) -- (-1, 2) ;
\draw[-,green!50!black] (-4, -2) -- (0, 2) ;
\draw[-,green!50!black] (-3, -2) -- (1, 2) ;

\draw[-,red] (-4, 1) -- (4, -1) ;
\draw[-,red] (-3, 2) -- (5, 0) ;
\draw[-,red] (-5, 0) -- (3, -2);

\end{tikzpicture}
\end{document}

conjugate diameters

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.