我想用虚线样式画一个半圆,并在半圆上标注两个顶点。我用了下面的代码,但奇怪的是这两个顶点没有落在半圆上。我不知道为什么。
\documentclass[tikz, border=1mm]{standalone}
\begin{document}
\begin{tikzpicture}
% Draw a dashed semicircle
%\draw (0,0) circle (1cm);
\draw [dashed](0,0) arc (0:180:1cm);
% Define angles for the vertices
\def\angleA{60}
\def\angleB{\angleA - 60}
% Mark two adjacent vertices on the semicircle using nodes
\node[circle, fill, inner sep=1.5pt, label=left:A] (A) at (\angleA:1cm) {};
\node[circle, fill, inner sep=1.5pt, label=left:B] (B) at (\angleB:1cm) {};
% Draw an edge on the semicircle between A and B
\draw (A) arc (\angleA:\angleB:1cm);
\end{tikzpicture}
\end{document}
看上去这个半圆的圆心不是(0,0)。
以下输出是我想要的。
答案1
由于您的问题已通过评论解决,因此这只是一个题外的建议。我将按以下方式绘制您的图像:
\documentclass[tikz, margin=3 mm]{standalone}
\begin{document}
\begin{tikzpicture}[
dot/.style = {circle, fill, inner sep=1.5pt,
label= #1, node contents={}},
every label/.append style = {inner sep=1pt}
]
\draw [dashed] (1,0) arc (0:180:1cm);
\draw (1,0) node[dot=right:B] arc [start angle=0,
delta angle=60,
radius=1] node[dot=60:A];
\end{tikzpicture}
\end{document}