如何连接线段与圆弧?

如何连接线段与圆弧?

我有三个固定点,通过它们我构造了一个圆弧,并用一个线段将其封闭。虽然一端连接得很好,但另一端的线段末端却伸出来了。有人有什么建议吗?

\documentclass[10pt]{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[line cap=round, scale=2.5]
\tkzDefPoint(2.687709573031439,6.723599641337466){A}
\tkzDefPoint(3.482076594620169,7.39830324031115){B}
\tkzDefPoint(4.2961211542514635,6.723599641337466){C}
\tkzCircumCenter(A,B,C)\tkzGetPoint{O}
\tkzDrawArc[line width=1pt,color=black](O,C)(A)
\tkzDrawSegment[line width=1pt](A,C)
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

在我处理这个问题时,问题似乎已经解决了,但这可能很有趣。基本思想是将线段和圆弧组合成一条路径并以 结尾-- cycle;。问题在于处理 TikZ 圆弧参数。同样,cycle没有帮助。

\documentclass[10pt]{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[line cap=round, scale=2.5]
\tkzDefPoint(2.687709573031439,6.723599641337466){A}
\tkzDefPoint(3.482076594620169,7.39830324031115){B}
\tkzDefPoint(4.2961211542514635,6.723599641337466){C}
\tkzCircumCenter(A,B,C)\tkzGetPoint{O}
%\path (A) node{A} (B) node{B} (C) node{C} (O) node{O};
\path (A);\pgfgetlastxy{\Ax}{\Ay}
\path (C);\pgfgetlastxy{\Cx}{\Cy}
\path (O);\pgfgetlastxy{\Ox}{\Oy}
\pgfmathsetmacro{\angleA}{atan2(\Ay-\Oy, \Ax-\Ox)}
\pgfmathsetmacro{\angleC}{atan2(\Cy-\Oy, \Cx-\Ox)}
\pgfmathsetmacro{\rx}{(\Ax-\Ox)/2.5cm}% veclen undefined
\pgfmathsetmacro{\ry}{(\Ay-\Oy)/2.5cm}
\pgfmathsetmacro{\radius}{sqrt(\rx*\rx+\ry*\ry)}
\draw[line width=1pt] (A) -- (C) arc[start angle=\angleC, end angle=\angleA, radius=\radius] -- (C);
%\node[below] at (current bounding box.south) {\angleA, \angleC, \radius};
\end{tikzpicture}
\end{document}

相关内容