# How to draw right arc of ellipse with tikz?

I want to draw a part of the ellipse from B to D as shown. I calculated the angle BAD and then used arc command to draw. But the result is not the desire. I have to find out, the command arc change center of the center origin ellipse. I can use the \clip command to crop the desired BD output. But is there a way to draw a BD?

Here is code

\documentclass{article}
\usepackage{tkz-euclide}
\usetikzlibrary{intersections}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\tkzDefPoint(0,0){A}
\tkzDefPoint(3,0){B}
\tkzDefPoint(-4,-2){C}
\draw[dashed,thin,name path=elip] (A) ellipse (3cm and 1cm);
\draw[draw=none,name path=AC] (A)--(C);
\draw[name intersections={of=elip and AC, by={D}}];
\tkzDrawPoints[fill=black](A,B,C,D)
\tkzDrawSegments(A,B A,D D,C)
\tkzLabelPoints(A,B,C,D)
\tkzFindAngle (B,A,D) \tkzGetAngle{an} \FPround\an\an{0}
\draw (B) arc (0:\an:3cm and 1cm);
\draw (0,2) node{$\widehat{BAD}=\an^\circ$};
\end{tikzpicture}
\end{document}


• The angle was computed assuming x radius=y radius, which is not the case for an ellipse. – John Kormylo Sep 26 '17 at 3:30
• @JohnKormylo Yes. I know that. But I do not know to draw an ellipse from B to D. – Afrendly Lee Sep 26 '17 at 3:45

One can compute the correct angle using pgfmath and atan2.

\documentclass{article}
\usepackage{tkz-euclide}
\usetikzlibrary{intersections}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\tkzDefPoint(0,0){A}
\tkzDefPoint(3,0){B}
\tkzDefPoint(-4,-2){C}
\draw[dashed,thin,name path=elip] (A) ellipse (3cm and 1cm);
\draw[draw=none,name path=AC] (A)--(C);
\draw[name intersections={of=elip and AC, by={D}}];
\tkzDrawPoints[fill=black](A,B,C,D)
\tkzDrawSegments(A,B A,D D,C)
\tkzLabelPoints(A,B,C,D)
\tkzFindAngle (B,A,D) \tkzGetAngle{an} \FPround\an\an{0}
\pgfmathsetmacro{\ann}{atan2(sin(\an),cos(\an)/3)}% compute compensated angle
\draw (B) arc (0:\ann:3cm and 1cm);
\draw (0,2) node{$\widehat{BAD}=\an^\circ$};
\end{tikzpicture}
\end{document}


• Thanks for help. But it not working well when change B and a of ellipse. Example \tkzDefPoint(6,0){B} \draw[dashed,thin,name path=elip] (A) ellipse (6cm and 1cm); \draw (B) arc (0:\ann:6cm and 1cm); – Afrendly Lee Sep 26 '17 at 5:34
• Did you divide sin(\an) by the y radius (1) and cos(\an) by the x radius (now 6)? – John Kormylo Sep 26 '17 at 13:34
• No, i don't. I just try again. If change only C, it work. If change A or B, not working. Ex: A(0;1) or B(3;1) – Afrendly Lee Sep 27 '17 at 5:51
• In general, A, B and D change. As B and D are the intersection of two straight lines with ellipse. We need to draw ellipses from B to D. – Afrendly Lee Sep 27 '17 at 6:22

Thank to @John Kormylo. I solved my problem from your code. This is code.

\documentclass[border=1mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\title{Arc of ellipse}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\tkzDefPoint(0,0){O}
\coordinate(A) at ([shift={(O)}]-50:3cm and 1cm);
\coordinate(B) at ([shift={(O)}]-130:3cm and 1cm);
\tkzDefPoint(3,0){O1}
\tkzLabelPoints(O,A,B)
\tkzFindAngle (O1,O,A) \tkzGetAngle{ana}
\pgfmathsetmacro{\anna}{atan2(sin(\ana),cos(\ana)/3)}
\tkzFindAngle (O1,O,B) \tkzGetAngle{anb}
\pgfmathsetmacro{\annb}{atan2(sin(\anb),cos(\anb)/3)}
\draw[color=blue] (A) arc (\anna:\annb:3cm and 1cm);
\draw[color=violet] (A) arc (\anna:360+\annb:3cm and 1cm);
\tkzDrawPoints[fill=black](O,A,B)
\end{tikzpicture}
\end{document}


A PSTricks solution for comparison purpose only.

\documentclass[pstricks]{standalone}
\usepackage{pst-eucl}

\begin{document}
\begin{pspicture}(12,10)
\rput(6,5)
{
\pstGeonode[PosAngle=-60]
(0,0){A}
(!5 3 0 PtoCab){B}
(!5 3 -130 PtoCab){D}
([nodesep=6]{D}A){C}
}
\pcline(A)(C)
\pcline(A)(B)
\psellipticarc[origin={A},linestyle=dashed](A)(5,3){(B)}{(D)}
\psellipticarcn[origin={A}](A)(5,3){(B)}{(D)}
\rput(6,9){$\widehat{BAD}=-130^\circ$}
\end{pspicture}
\end{document}


• Thanks for help. But it's not tikz. – Afrendly Lee Sep 26 '17 at 9:12
• @AfrendlyLee: I have already mentioned that it is a PSTricks solution. – Well Harassed Programmer Sep 26 '17 at 9:36