我想画出如图所示的从 B 到 D 的椭圆的一部分。我计算了角度 BAD,然后使用 arc 命令进行绘制。但结果并不理想。我必须找出 arc 命令改变中心原点椭圆的中心。我可以使用 \clip 命令裁剪所需的 BD 输出。但是有没有办法绘制 BD?
这是代码
\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}
我使用谷歌翻译。谢谢。
答案1
可以使用 pgfmath 和 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}
答案2
感谢@John Kormylo。我从你的代码中解决了我的问题。这是代码。
\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}
答案3
PSTricks 解决方案仅用于比较目的。
\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}