使用 Tkz-Euclide 完美标记圆的短圆弧/长圆弧

使用 Tkz-Euclide 完美标记圆的短圆弧/长圆弧

在 Tkz-Euclide 中,是否有一种“内置”(自动)的方法来标记圆的优弧或小弧?

例如,在下面的圆中,我想将小圆弧 CD 标记为 58 度(最好不需要计算并在该圆弧的完美中心放置一个点或节点!)。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{gensymb} %for degree symbol
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = above left:$A$] (A) at (130:3);
\coordinate[label = above right:$D$] (D) at (58:3);
\coordinate[label = right:$C$] (C) at (0:3);
\coordinate[label = left:$B$] (B) at (180:3);
\draw (B) -- (D) -- (C);
\draw (B) -- (A) -- (C);
\draw (B) -- (C);
\tkzInterLL(A,C)(B,D) \tkzGetPoint{E}
\tkzLabelPoints[above](E)
\tkzMarkAngle[size=0.60cm,%
opacity=.9](B,E,C)
\tkzLabelAngle[pos = 0.9](B,E,C){$126\degree$}
\tkzMarkAngle[size=0.9cm,%
opacity=.9](D,C,E)
\tkzLabelAngle[pos = 1.3](D,C,E){$36\degree$}
\end{tikzpicture}
\end{center}
\end{document}

我知道有一种选择是创建一个新的坐标点并用 标记它,\coordinate[label = above right:$58\degree$] (F) at (29:3);但这需要计算该弧的完美中心。理想情况下,我想要一个简单的命令,例如\tkzLabelMinorArc[above right](D,C){$58\degree$}

我看到这个 Tkz-Euclide 备忘单Tkz-Euclide 有类似的命令,用于\tkzLabelPoint\tkzLabelAngle\tkzLabelLine\tkzLabelSegment\tkzLabelCircle,但我找不到命令来为圆的短弧或长弧制作完美的标签。有人知道 Tkz-Euclide 中是否存在此选项吗?

编辑:这个问题更新了好久。是否也可以选择在需要时局部(在特定情况下,而不是整个文档)舍入弧度测量,类似于\FPRound:这个问题更新了这个答案

答案1

您使用了\usetkzobj{all},所以您没有使用最新版本,tkz-euclide即 3.06。下面的解决方案使用了最新版本。使用 是可能的,tkz-euclide但我们需要创建一个新的宏。您可以使用 获得弧的中间部分 \tkzGetPoint{M}。您可以调整结果,但您需要更改

\node[#1] at (tkzPointResult) {\pgfmathprintnumber{\tkz@An}\degree};

如果有必要的话,可以添加一些特定的选项。

\documentclass{standalone} 
\usepackage{tkz-euclide}
\usepackage{gensymb} 
\makeatletter

\def\tkzMarkArc{\pgfutil@ifnextchar[{\tkz@MarkArc}{\tkz@MarkArc[]}}   
\def\tkz@MarkArc[#1](#2,#3,#4){% 
\begingroup
\tkzCalcLength[cm](#4,#3) \tkzGetLength{tkz@len}
\tkzFindSlopeAngle(#4,#2)\tkzGetAngle{tkz@anga}
\tkzFindSlopeAngle(#4,#3)\tkzGetAngle{tkz@angb}
\tkzNormalizeAngle(\tkz@anga,\tkz@angb)
\edef\tkz@An{\fpeval{(\tkz@SecondAngle-\tkz@FirstAngle)}}
\edef\tkz@Angle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
\tkzDefPoint(\tkz@Angle :\tkz@len){tkzPointResult}
\node[#1] at (tkzPointResult) {\pgfmathprintnumber{\tkz@An}\degree};
\endgroup 
}
\makeatother

\begin{document} 

\begin{tikzpicture}
\tkzDefPoint(0,0){O}
\pgfmathsetmacro\r{2}
\tkzDefPoint(30:\r){A}
\tkzDefPoint(85:\r){B}
\tkzDrawCircle(O,A)

\tkzMarkArc[above right](A,B,O)  \tkzGetPoint{M}

\tkzDrawPoints(B,A,M)
\tkzLabelPoints[above right](O,A,B)
\end{tikzpicture}

 \end{document}

在此处输入图片描述

答案2

在手册中没有看到任何内容,但是您可以定义这样的宏。不能保证下面的示例在所有情况下都能正常工作,但它在这里似乎工作正常。

在此处输入图片描述

\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
%\usetkzobj{all}
\usepackage{gensymb} %for degree symbol

\usetikzlibrary{calc}
\newcommand\LabelMinorArc[4][]{%
% optional arg: options for node
% mandatory args
%  - center coordinate
%  - first point circle
%  - second point on circle
\path let
\p1=(#2),\p2=(#3),\p3=(#4),
\n1={atan2(\y2-\y1,\x2-\x1)},
\n2={atan2(\y3-\y1,\x3-\x1)},
\n3={scalar(\n2-\n1)},
\n4={veclen(\x2-\x1,\y2-\y1)}
in
(#2) ++(\n3/2+\n1:\n4) node[#1] {$\pgfmathprintnumber{\n3}\degree$};
}

\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (3);
\coordinate[label = above left:$A$] (A) at (130:3);
\coordinate[label = above right:$D$] (D) at (58:3);
\coordinate[label = right:$C$] (C) at (0:3);
\coordinate[label = left:$B$] (B) at (180:3);
\draw (B) -- (D) -- (C);
\draw (B) -- (A) -- (C);
\draw (B) -- (C);
\tkzInterLL(A,C)(B,D) \tkzGetPoint{E}
\tkzLabelPoints[above](E)
\tkzMarkAngle[size=0.60cm,%
opacity=.9](B,E,C)
\tkzLabelAngle[pos = 0.9](B,E,C){$126\degree$}
\tkzMarkAngle[size=0.9cm,%
opacity=.9](D,C,E)
\tkzLabelAngle[pos = 1.3](D,C,E){$36\degree$}

\LabelMinorArc[above right]{O}{C}{D}
\LabelMinorArc[above]{O}{D}{A}
\LabelMinorArc[left]{O}{A}{B}

\end{tikzpicture}
\end{document}

相关内容